Here's my formview..
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="recid">
<EditItemTemplate>
RECID:
<asp:TextBox ID="recid" runat="server" Text='<%# Eval("RECID") %>' ReadOnly="true" />
<br />
SHIPPER:
<asp:TextBox ID="shipper" runat="server" Text='<%# Bind("SHIPPER") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
</asp:FormView>
here's my sqldatasource1
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM IMPORT WHERE (RECID = ?)"
UpdateCommand="UPDATE IMPORT SET SHIPPER=@shipper WHERE RECID=@recid" >
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="RECID" PropertyName="Text" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="recid" Type="Int32" />
<asp:Parameter Name="shipper" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
Now, my problem is that everytime I update the page, this is the error Input string was not in a correct format.
I tried changing the @recid in the UpdateCommand into a constant UpdateCommand="UPDATE IMPORT SET SHIPPER=@shipper WHERE RECID=11186"
this worked well, the update was successful.
I think the @recid is being treated as a string here in the UpdateCommand. Can someone please help me? What do I need to do in order to change the data type of @recid to Integer?
Thanks!