I am using ASP.net 3.5 and i am getting this error.
Must declare the scalar variable "@Ad1".
What am i doing wrong?
My Submit button
Protected Sub btnUpdate_Click
Try
AddressSRC.Update()
lblResult.Visible = True
Catch ex As Exception
lblResult.Visible = True
lblResult.Text = ex.Message
End Try
LoadData()
End Sub
My ASPX page where my SQLDatasource is sitting - I have the parramators though.
<asp:SqlDataSource ID="AddressSRC" runat="server"
ConnectionString="<%$ ConnectionStrings:SLConn %>"
ProviderName="<%$ ConnectionStrings:SLConn.ProviderName %>"
UpdateCommand="UPDATE ADDRESS
SET Address1 = @Ad1, Address2 = @Ad2
WHERE entityID = 'CRB'
AND addressID = @AdID ">
<UpdateParameters>
<asp:ControlParameter ControlID="txtPaddress1" Name="Ad1" PropertyName="Text" Type="String"/>
<asp:ControlParameter ControlID="txtPaddress2" Name="Ad2" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtAddressID" Name="AdID" PropertyName="Text" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>