I am using CreateUserWizard Control to register clients in my SQL Database. I have two tables: Customers and Categories. Customers CustomerID is a foreign key in Categoris. It is also automatically generated when values are inserted into Customers table.
Categories tables receives values from CheckBoxList control as CatCodes.
Everything works fine but one. When values are inserted into Customers and Categories table during registration, CustomerID is not inserted into the Categories table using the following sql code:
<asp:SqlDataSource ID="InsertDealerId" runat="server" ConnectionString="<%$ ConnectionStrings:myconnection %>"
InsertCommand="INSERT INTO [Categories] ([CustomerID])
SELECT Customers.CustomerID FROM Customers WHERE Customers.CustomerID = @CustomerID"
ProviderName="<%$ ConnectionStrings:myconnection.ProviderName %>">
<asp:Parameter Name="DealerID" />
I have tested is in SQL management studio and it gives no error, which means code is correct. Also, following is my full code with code behind to better understand what is going on. It's been a week now I am struggling with this and can't und
View Complete Post