On a "Save" command, I'm trying to update multiple edited rows on an Excel like grid, the columns of which look like this:
Here's my "Save" command:
And my stored procedure looks like this:
The error that I'm getting is Procedure or function spExcelGridTestUpdateTable has too many arguments specified. Most folks getting this error seem to simply have a typo when it comes to one of the parameter names, but I've checked and everything seems to line up. If I execute the SP from SQLServer and provide the parameters (or pass NULL params), the SP runs fine.
UPDATE (10/4/2013 1:09PM): Adding this line before I start adding parameters prevents the error, but the table still doesn't get updated:
<Columns> <telerik:GridNumericColumn DataField="CarID" DataType="System.Int32" HeaderText="ID" SortExpression="CarID" UniqueName="CarID" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" HeaderStyle-Width="100" ItemStyle-Width="100" FilterControlWidth="60" ReadOnly="false"/> <telerik:GridBoundColumn DataField="CarMake" DataType="System.String" HeaderText="Car Make" SortExpression="CarMake" UniqueName="CarMake" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" HeaderStyle-Width="120" ItemStyle-Width="120" FilterControlWidth="80" /> <telerik:GridBoundColumn DataField="CarModel" DataType="System.String" HeaderText="Car Model" SortExpression="CarModel" UniqueName="CarModel" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" HeaderStyle-Width="120" ItemStyle-Width="120" FilterControlWidth="80" /> <telerik:GridBoundColumn DataField="CarTrim" DataType="System.String" HeaderText="Car Trim" SortExpression="CarTrim" UniqueName="CarTrim" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" HeaderStyle-Width="200" ItemStyle-Width="200" FilterControlWidth="160"/> <telerik:GridNumericColumn DataField="CarYear" DataType="System.Int32" HeaderText="Car Year" SortExpression="CarYear" UniqueName="CarYear" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" HeaderStyle-Width="100" ItemStyle-Width="100" FilterControlWidth="60" /></Columns>Here's my "Save" command:
Case "Save" For Each editedItem As GridEditableItem In RadGridViewExcelGridTest.EditItems Dim newValues As Hashtable = New Hashtable 'The GridTableView will fill the values from all editable columns in the hash e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem) SqlDataSourceExcelGridTest.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure SqlDataSourceExcelGridTest.UpdateCommand = "spExcelGridTestUpdateTable" SqlDataSourceExcelGridTest.UpdateParameters.Add(New Parameter("CarID", DbType.Int32)) SqlDataSourceExcelGridTest.UpdateParameters.Add(New Parameter("CarMake", DbType.String)) SqlDataSourceExcelGridTest.UpdateParameters.Add(New Parameter("CarModel", DbType.String)) SqlDataSourceExcelGridTest.UpdateParameters.Add(New Parameter("CarTrim", DbType.String)) SqlDataSourceExcelGridTest.UpdateParameters.Add(New Parameter("CarYear", DbType.Int32)) SqlDataSourceExcelGridTest.Update() editedItem.Edit = False NextAnd my stored procedure looks like this:
ALTER PROCEDURE [dbo].[spExcelGridTestUpdateTable] -- Add the parameters for the stored procedure here @CarID int, @CarMake varchar(100), @CarModel varchar(100), @CarTrim varchar (100), @CarYear intASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; UPDATE [dbo].[TestTable_Cars] SET CarMake=@CarMake, CarModel=@CarModel, CarTrim=@CarTrim, CarYear=@CarYear WHERE CarID=@CarIDENDThe error that I'm getting is Procedure or function spExcelGridTestUpdateTable has too many arguments specified. Most folks getting this error seem to simply have a typo when it comes to one of the parameter names, but I've checked and everything seems to line up. If I execute the SP from SQLServer and provide the parameters (or pass NULL params), the SP runs fine.
UPDATE (10/4/2013 1:09PM): Adding this line before I start adding parameters prevents the error, but the table still doesn't get updated:
SqlDataSourceExcelGridTest.UpdateParameters.Clear()