I have an asp.net web form page with 2 drop down lists on it. Each drop down list has the same values, they are just lists of all the active users in the database. I want the command to copy all the rows of data from user1 to user2. I have place this sql statement in SSMS and replaced the parameters with users and it ran fine, but I cannot get the command to work in visual studio. It runs fine, but doesn't grab the parameters, therefore nothing changes.
<asp:SqlDataSource ID="AssetSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:meindbConnectionString %>"
InsertCommand="INSERT INTO Assets (USERNAME, ASSETTAG,
SERIALNUMBER, DEPT, CATEGORY, ITEMDESC, MODEL, ISSUEDATE, ISSUEDBY,
TOTALVALUE, ACCESSORIES, ISSUECONDITION, NOTES, CREATEBY, CREATEDATE)
SELECT @USERNAME2, ASSETTAG, SERIALNUMBER, DEPT, CATEGORY, ITEMDESC, MODEL,
ISSUEDATE, ISSUEDBY, TOTALVALUE, ACCESSORIES, ISSUECONDITION, NOTES,
CREATEBY, CREATEDATE FROM ASSETS WHERE USERNAME = @USERNAME">
<InsertParameters>
<asp:ControlParameter ControlID="ContentPlaceHolder1$WebGroupBox1$FormView1$UserWebDropDown" Name="USERNAME" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="ContentPlaceHolder1$WebGroupBox1$FormView1$WebDropDown1" Name="USERNAME2" PropertyName="SelectedValue" Type="String" />
<asp:Parameter Name="ASSETTAG" Type="String" />
<asp:Parameter Name="SERIALNUMBER" Type="String" />
<asp:Parameter Name="DEPT" Type="String" />
<asp:Parameter Name="ITEMDESC" Type="String" />
<asp:Parameter Name="MODEL" Type="String" />
<asp:Parameter Name="ISSUEDATE" Type="DateTime" />
<asp:Parameter Name="ISSUEDBY" Type="String" />
<asp:Parameter Name="CATEGORY" Type="String" />
<asp:Parameter Name="TOTALVALUE" Type="Int32" />
<asp:Parameter Name="ACCESSORIES" Type="String" />
<asp:Parameter Name="ISSUECONDITION" Type="String" />
<asp:Parameter Name="NOTES" Type="String" />
<asp:Parameter Name="CREATEDATE" Type="DateTime" />
<asp:ControlParameter ControlID="UsernameHiddenField" Name="CREATEBY" PropertyName="Value" Type="String" />
<asp:Parameter Direction="Output" Name="ID" Type="Int32" />
</InsertParameters>
Does anyone have any suggestions on why it is not working? thank you in advance for your responses