Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem With Update
Message
From
02/12/2009 17:11:51
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01437326
Message ID:
01437382
Views:
57
How have you set up the commands that the DataAdapter expects to be set when using its .Update() method? Are you using a CommandBuilder? Have you set it up yourself? Have you read my blog about DataAccess? (3-part series: http://geek-goddess-bonnie.blogspot.com/2009/09/dataaccess-part-i.html)

~~Bonnie


>I am calling a stored proc to get back a DS of data:
>
>
>CREATE PROCEDURE wit_GetPickListData
>	@ItemType	VARCHAR(20)
>
>AS
>BEGIN
>
>	SELECT ItemKey, ItemType, Caption, ItemDesc
>		FROM wit_PickLists
>		WHERE ItemType = @ItemType
>		ORDER BY Caption
>
>END
>
>
>I then bind the data set to a listbox and a text box:
>
>
>// Bind the data set to the listbox
>lstItems.DataSource = dsItems.Tables[0];
>lstItems.DisplayMember = "Caption";
>
>lstItems.SelectedIndex = -1;
>
>// Bind the caption
>txtCaption.DataBindings.Add("Text", dsItems.Tables[0], "Caption");
>
>
>After I change the value in the textbox I can see te change in the DS using the visualizer. I call UpdateDataSet:
>
>
>public void UpdateDataSet(DataSet oDS, string sTableName)
>{
>    if (sTableName == null)
>    {
>        sTableName = oDS.Tables[0].TableName;
>    }
>
>    DataTable oTable = oDS.Tables[sTableName];
>
>    foreach (DataRow oRow in oTable.Rows)
>    {
>        oRow.EndEdit();
>    }
>
>    try
>    {
>        _oAdapter.Update(oDS, sTableName);
>    }
>    catch (SqlException e)
>    {
>        throw e;
>    }
>}
>
>
>
>It's erroring with "Procedure or function 'wit_GetPickListData' expects parameter '@ItemType', which was not supplied."
>
>I don't understand this at all. Why does .Net care about this proc at this point?? What am I doing wrong here???
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform