Imar -
OMG!!! How much do I love you? That worked perfectly. I noticed that you answer a lot of postings and I want to thank you, thank you, thank you!
I started the next text and...Next challenge. I thought when that when I had a field in the database that matched the username, I could use a WHERE clause in my database to filter (ie. accountUserName = username)... This is not working.
Here is the scenario
1. User creates account.
2. Login lands at the form we just created and enters detailed information in tblAccounts. Username populates accountUserName field (thanks to you). Submit takes them to a page accountDetails.aspx, a detailsview that is filtered by username.
3. User Logs out
4. When User logs back in, the login takes them back to accountDetails.aspx filtered by the username. They can edit details if needed. (WHERE accountUserName = username).
I created the accountDetails.aspx page and filtered the datasource by session field username.
Here is the code from the form...
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="" DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="accountID" HeaderText="accountID" InsertVisible="False"
ReadOnly="True" SortExpression="accountID" />
<asp:BoundField DataField="accountUserName" HeaderText="accountUserName" SortExpression="accountUserName" />
<asp:BoundField DataField="accountFirstName" HeaderText="accountFirstName" SortExpression="accountFirstName" />
<asp:BoundField DataField="accountLastName" HeaderText="accountLastName" SortExpression="accountLastName" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connCPFAAEvents %>"
DeleteCommand="DELETE FROM [tblUserDetails] WHERE [accountID] = @accountID" InsertCommand="INSERT INTO [tblUserDetails] ([accountUserName], [accountFirstName], [accountLastName]) VALUES (@accountUserName, @accountFirstName, @accountLastName)"
ProviderName="<%$ ConnectionStrings:connectionName.ProviderName %>"
SelectCommand="SELECT [accountID], [accountUserName], [accountFirstName], [accountLastName] FROM [tblUserDetails] WHERE ([accountUserName] = @accountUserName)"
UpdateCommand="UPDATE [tblUserDetails] SET [accountUserName] = @accountUserName, [accountFirstName] = @accountFirstName, [accountLastName] = @accountLastName WHERE [accountID] = @accountID">
<DeleteParameters>
<asp:Parameter Name="accountID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="accountUserName" Type="String" />
<asp:Parameter Name="accountFirstName" Type="String" />
<asp:Parameter Name="accountLastName" Type="String" />
<asp:Parameter Name="accountID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter Name="accountUserName" SessionField="username" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="accountUserName" Type="String" />
<asp:Parameter Name="accountFirstName" Type="String" />
<asp:Parameter Name="accountLastName" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
Thank you again!
P.S. Just to clarify for visitors to this post, I am using code-behind. All I had to do was open the webpage.aspx.
vb file and paste the text into the page.