Prev: How to get textboxes to retain previously entered data?
Next: Visual Basic Power Packs DataRepeater Control - Empty Template?
From: User on 30 Sep 2010 00:20 I am using a OleDb SqlDataSource to bind to a GridView The SqlDataSource is defined as follows: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ProviderName="System.Data.OleDb" ... UpdateCommand="mp_Update" UpdateCommandType = "StoredProcedure" ... > <UpdateParameters> <asp:Parameter Name="@ret_val" Type="Int32" Direction=ReturnValue /> <asp:Parameter Name="usr_id" Type="String" Size="32" /> <asp:Parameter Name="usr_name" Type="String" Size="32" /> </UpdateParameters> </asp:SqlDataSource> The UpDateCommand uses a stored procedure with a return value and two input parameters (ie. "usr_id" and "usr_name"). The DataKeyNames in the GridView is set to "usr_id" When the update actually happens, somehow the SqlDataSource is mangling the order of the parameters. In SQL Server Profiler, I see that it issues mp_Update <usr_name>, <usr_id> instead of mp_Update <usr_id>, <usr_name> as I would have expected since I manually defined the UpdateParameters. How can I fix this so that the parameter order in the call will match the stored procedure definition ?? Note: changing the SqlDataSource provider to System.Data.SqlClient does work. The order is still mixed up, but the provider issues mp_Update @user_name=<usr_name>, @usr_id=<usr_id> and thus the mangled order does not matter. |