Asked by:
FIX - DataSet Error "Could not find a non generic method"

Question
-
User2020834294 posted
Hi everyone.
After dealing with this error for 2 weeks i finnally found the fix for it. First of all the error is caused by a "not found" parameters that looks like this: original_PrimaryKey. This is correct if you use optimistic concurrency or if your primary key is updatable.
In order to correct this problem, got to the .aspx page with the ObjectDataSource that is causing the error, click on source (not the code beside) and locate the ObjectDataSource tag. It should look like this:
<
asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="PaintingsTableAdapters.proc_PaintingsLoadAllTableAdapter" UpdateMethod="Update">The bold section represent the problematic section. Modify the "OldValuesParameterFormatString" value from "original_{0}" to "{0}". Et voilà !!!
No more "Could not find a non-generic...." error.
Hope it helps you guys.
p.s.: I am using Visual Studio 2005 Professional Version 8.0.50727.42 (RTM-050727-4200) Is there a more current version that my office should upgrade to or this one is ok?
Monday, March 6, 2006 1:48 AM
All replies
-
User453338705 posted
It's great post. Thanks a lot. Literaturally it saves my "life"[:D]
Friday, March 10, 2006 8:57 AM -
User1271688261 posted
I tried this fix.... and got a new error:
Value cannot be null.
Parameter name: Original_ItemTuesday, March 21, 2006 2:51 PM -
User154133944 posted
Thank you very much amensi. Great post!!!!Tuesday, March 28, 2006 12:10 PM -
User322099544 posted
Perfect. Works GREAT! Thanks so much.
Tuesday, April 4, 2006 2:46 PM -
User-725370733 posted
I tried this fix.... and got a new error:
Value cannot be null.
Parameter name: Original_ItemYup, me too!
Monday, April 10, 2006 12:24 PM -
User215074072 posted
The root of the problem has to do with the TableAdapter and its configuration wizard within the DataSet.xsd.
By default, Visual Studio will enable the "Refresh the data table" option on the "Advanced Options" dialog accessible via a button in the lower left corner of the "Enter a SQL Statement" page of the TableAdapter Configuration Wizard. If the "Refresh the data table" checkbox is checked, it will append a SELECT statement to the end of the UPDATE and INSERT statements to "retrieve identity column values, default values, and other values calculated by the database" of the row that was just updated. To do this, it needs the "<PKField>" in addition to the "original_<PKField>" to be sent from the DataGrid control . When the column property for the primary key is set to ReadOnly = True, the DataGrid will not include the "<PKField>" in its Parameters collection during the Update method call. (note: <PKField> is the field name of your primary key as in "ID", or "original_ID")
When ever we Update from the DataGrid, the "original_<PKField>" will be sent. This is good. It's the additional requirement of sending the "<PKField>" for the additional SELECT statement at the end of the Update query that is messing up our DataGrid's functionality.
In other words, if the DataGrid is bound to the methods in the TableAdapter via an ObjectDataSource, and if the primary key column of the DataGrid is set ReadOnly=True, the DataGrid control will not pass the primary key to the Update and Insert methods of the TableAdapter even though those methods require it. Instead, it will only include the "original_<PKField>"which it will use to locate the correct record to update.
Disabling the "Refresh the data table" checkbox on the "Advanced Options" dialog during configuration of the TableAdapter makes the most sense to me and has the least impact on design and functionality while still allowing the IDE to generate most of the code.
Some people have suggested changing the OldValuesParameterFormatString of the ObjectDataSource from "original_{0}" to simply "{0}", but this then causes the "original_<PKFieldName>" (i.e. "original_ID"), which is still there in the parameters collection of the ObjectDataSource, to never be initialized (i.e. null will be passed in the Parameters collection during the Update and Insert) by the GridView, resulting in the "Value cannot be null" error if your field cannot be null. Some people benifited from the OldValuesParameterFormatString fix, but I believe it was because their fields could be null.
Thursday, May 4, 2006 4:57 PM -
User2020834294 posted
Are you guys including this parameter in your grid... To do an update you need the PrimaryKey to be in the grid.Friday, May 5, 2006 10:59 AM -
User215074072 posted
Yes, you'll need to have the ID included in the Grid, but set its visibility to hidden if you don't want to see it. The Grid needs it when sending the original primary key value back to the table adapter.
Saturday, May 6, 2006 10:39 PM -
User57398933 posted
Well it's great you found a fix. What I'm about tired of is the useless databinding. Two versions and it's still a joke. You can't REALLY do visual databinding with VS2005. I mean, sure if you like to hand work your code, which means you better remember what you did when you come back to modify it.
Basically, they still don't have it right. Some interesting attempts, but things like connection strings you can't swap at runtime (Datasets), ObjectDatasource doesn't really work with wizard generated strongly typed datasets, the dataset wizard can't handle temp tables in stored procedures...
The list goes on and on. Did someone actually try to write a real world application with the visual designer before this thing made it out the door? Obviously not.
Sorry guys I'm just disgusted with the amount of time I've wasted on this. Delphi still kicks VS 2005's butt - and it shouldn't. And please don't try to tell me it works. Just do a search on ObjectDataSource and watch all the work arounds that fall out. If you don't mind handcoding all your database access, yeah it works great.
Regards,
Nick H
Tuesday, June 27, 2006 6:33 PM -
User57398933 posted
Well and now suddenly it starts working - my objectdatasources are now saving data without the error. No idea why. I recreated everything just in case something was corrupt.
So cool - half what I said still applies, but at least the databinding seems to be working. I was wrong on that. 8)
Regards,
Nick H
Tuesday, June 27, 2006 9:57 PM -
User456008637 posted
I am also getting the "Could not find a non generic method" error, but the fix for my end was adding a non-generic method containing the exact parameters being passed.
Wednesday, July 19, 2006 3:19 PM -
User-655219249 posted
This is my object data source which returns a data view
<asp:ObjectDataSource OldValuesParameterFormatString="original_{0}" ID="odsIndustryDDL" runat="server" TypeName="Industry" SelectMethod="GetAllIndustriesForDDL()"></asp:ObjectDataSource>
This is my drop down list
<asp:DropDownList ID="ddlIndustry" runat="server" DataSourceID="odsIndustryDDL" DataTextField="industry_descr" DataValueField="industry_id"></asp:DropDownList>
Don't know what is wrong.
Also I do not want to add a update command to my object data source. I do not really need to add OldValuesParameterFormatString either as i will not be updating the grid.
any help is appreciated.
ThanksFriday, August 4, 2006 4:41 PM -
User-151299706 posted
For anyone still searching for a solution to "non-generic method" using ObjectDataSource error.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Your problem may be compounded because of a space in the field name for the primary key.
<o:p></o:p>
Removing the space and changing the OldValuesParameterFormatString from “original_{0}” to “{0}” worked for me.
<o:p></o:p>
I hope it helps.<o:p></o:p>
Wednesday, November 22, 2006 10:37 PM -
User1725577794 posted
Cool post ! but sadly this is only one of the reasons on why this error comes. This is not a fool proof solution for the error. [:(]
Thursday, November 23, 2006 7:47 AM -
User-854340466 posted
Thanks for your post ctut,
However after spending a fair bit of time on this problem recently, I've found that you're not quite correct in some statements. So just for your and others information:
By default, Visual Studio will enable the "Refresh the data table" option on the "Advanced Options" dialog.Disabling the "Refresh the data table" checkbox on the "Advanced Options" dialog during configuration of the TableAdapter makes the most sense to me and has the least impact on design and functionality while still allowing the IDE to generate most of the code.
This is not the case for me the "Refresh the data table" option isn't selected (by default or by me) and I still get the error.
Some people have suggested changing the OldValuesParameterFormatString of the ObjectDataSource from "original_{0}" to simply "{0}", but this then causes the "original_<PKFieldName>" (i.e. "original_ID"), which is still there in the parameters collection of the ObjectDataSource, to never be initialized (i.e. null will be passed in the Parameters collection during the Update and Insert) by the GridView, resulting in the "Value cannot be null" error if your field cannot be null. Some people benifited from the OldValuesParameterFormatString fix, but I believe it was because their fields could be null.
This is the only method I've found to work in my case and I do not allow my database field to be null. Maybe this makes sense to someone and I hope that this whole problem gets resolved soon.
/Ola
Thursday, November 30, 2006 10:37 PM -
User743499109 posted
I TOTALLY agree with you Nick. I have spent 3 good days just trying to use the so called databinding. Non of the solutions posted worked for me. I am actually used to writing my own data access layer. at least then I know what the heck is going on in the background.
I tried the 'Original_{0}' solution by ..Ola and alleluyah!!! no Error. BUT there was no Update too. It just didn't update. I guess Delphi still is the true RD tool, still unbitten.
Jaspa.
Tuesday, February 6, 2007 5:00 PM -
User1416329745 posted
I TOTALLY agree with you Nick. I have spent 3 good days just trying to use the so called databinding. Non of the solutions posted worked for me. I am actually used to writing my own data access layer. at least then I know what the heck is going on in the background.
I tried the 'Original_{0}' solution by ..Ola and alleluyah!!! no Error. BUT there was no Update too. It just didn't update. I guess Delphi still is the true RD tool, still unbitten.
Jaspa.
Try the solution in the link below the error is very simple you are updating Objectdatasource without a DAL to resolve the update.
Tuesday, February 6, 2007 8:03 PM -
User-1031746439 posted
ctut your post solved my problem thanks!
The only thing I had to do after unchecking the "Refresh the data tables" was to delete and insert a new ObjectDataSource control and it's working perfect, no more "could not find a non-generic method ". At first I tried switching the original_{0} to {0} method but it still gave me the error, so I put the original_{0} back and then unchecked the "Refresh the data tables" and it gave me the error, so I kept it unchecked and just deleted the ObjectDataSource and inserted a new one and bingo problem fix.
Sunday, March 11, 2007 9:23 PM -
User-540657241 posted
Hi,
I had another problem that caused the error. While throwing together a prototype I added a column to my db table called Completed. When I implemented my BLL I named the Insert method parameter IsCompleted. The ObjectDataSource then looked for a method with parameters named IsCompleted and Completed. When I changed the Insert method parameter to match the column name the problem resolved itself. I haven't got a clue why this should be. The BLL communicates with the DAL through it's exposed methods and I don't expect it to have any awareness of the underlying data.
BTW For everybody that's having problems because of the Refresh tables or original value property; you might want to take a look at the Data Access Tutorial http://www.asp.net/learn/dataaccess/tutorial21cs.aspx?tabid=63. This explains the default implementation of optimistic concurrency.
Wednesday, March 14, 2007 7:21 PM -
User-1353211744 posted
Hi "ctut", thank you for this solution, i was try to disable "Refresh the data table" and its work good,but thier is somthing, when i click "Update" after change the field, the DataGrid disappear but the update done ....
So what i can do to keep the data grid display on the page .
Tuesday, May 22, 2007 4:05 AM -
User215074072 posted
Is this happening during design time, when you finish editing the datasource and commit your changes? Or is this during runtime, when you click to postback your changes, and the datagrid fails to redraw or update?
Ctut
Wednesday, May 23, 2007 10:24 PM -
User-1670963251 posted
I'd like to take this time before I THROW MY PC OUT THE WINDOW and switch jobs to become a MAC DEVELOPER to thank the Databinding developers in MS for wasting my time with this crap. I'll be hand coding it without databinding because IT DOESNT WORK.
Say you have a set of CRUD stored procs built for a table.. a User table for instance. Your stored proc takes in "@UserID int" as a parameter and runs "DELETE from UserTable WHERE UserID=@UserID".
You think to yourself "SELF! Maybe the MS peeps have this right. Use a dataset as your DAL and save weeks of time. Hell it's only XSD, how hard can it be to get wrong?" (At this point I should have had a "great disturbance in the Force" feeling, but I didn't. I've been doing coding for 23 years and I STILL got suckerd. ::sigh::) When you point the Dataset designer to your CRUD procs, (using Delete as the example here, but it does it in Insert and Update as well) the fast, simple delete stored proc turns in dataset generator to something that wants me to send it all the old values for each and evry field in UserTable.
ARGH! Back to manual coding.
Friday, June 29, 2007 12:46 PM -
User-1485844772 posted
Most likely the error was caused by using a table with a primary key with columns ColumnA, ColumnB etc where they are primary key values and there is no autoincrement primary key column on the table. Visual Studio sets the Readonly to true for each of these columns by default though the TableAdapter autogenerates the update with these columns in the methods parameters by default - hence problem.
Change there properties to ReadOnly = False in the Gridview control edit columns click on each column and presto - problem solved.
Yeah yeah.
Wednesday, July 25, 2007 3:21 AM -
User-1485844772 posted
Additionally, if you then make the columns invisible or remove them, again they will not be automatically supplied to the generic Update call when the TableAdapter Update method is called. Therefore the Update adapter Update function would also require to be modified.
Wednesday, July 25, 2007 3:56 AM -
User-1833103596 posted
Using a ObjectDataSource to a grideview. with OldValuesParameterFormatString="original_{0}" if I remove the original it gives am error.
My delete method works fine but the the update gives an error,ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateOrder' that has parameters: original_OrderID1, OrderDetail1, Name, Order Details.
Select method works, Delete works but updates :(
string sql = "SELECT Employee.EmployeeFirstName AS Name, LunchPro1.OrderDetail1 AS [Order Details],LunchPro1.OrderID1 AS [OrderID1] FROM Employee LEFT OUTER JOIN LunchPro1 ON Employee.EmployeeID = LunchPro1.EmployeeID WHERE (LunchPro1.Datetimestamp1 >= DATEADD(DAY, -7, GETDATE()))";
Tuesday, August 21, 2007 8:56 AM -
User647688804 posted
WTH?!! When i use:
Original_{0}
Update works and Delete doesn't work, and when I use:
Original_{0}
Delete works and Update doesn't
!!!!!!!!!!!!!!!!!!!!!!!
Tuesday, August 21, 2007 3:34 PM -
User-2095024000 posted
Dear,
It solved my problem but when i click on update it does not update value in DB.
If i Pressed Edit and Enter "SomeValue" and then Click Update it does not update in DB.
Tuesday, September 11, 2007 8:42 AM -
User-2095024000 posted
I have two coloumns in a Grid
Crad_Nbr int and it's identity column
card_type varchar(50)
Click on Edit->I add some Text in Card-Type Column->Press Update but not updating in DB
Wednesday, September 19, 2007 3:00 AM -
User-1883862023 posted
I tried this, but it didn't fix the problem for me. After removing most of the fields I have on my grid view, I noticed that the field names with "ID" were causing the problem. Because my grid view was showing two fields "Applicant_ID" and "Position_ID", the former one is primary key while the latter one is foreign key in this table. It seems that .NET gets confused/sensitive by the fields names with "ID" in it. I replaced the "Position_ID" with "Position_Code", of course, including all the classes/methods/stored procedures, and it work! I hate to name the field in this way, but what else can I do....
Below is the codes that I have, which populates a gridview that shows applicants based on user's query on first name and last name. By selecting the individual records in the grid view, the user can view detail information of the applicant and can update information where I encounter the problem:
<
div>First Name:
<asp:TextBox ID="FirstName" runat="server" MaxLength="30" Width="160px"></asp:TextBox>Last name:
<asp:TextBox ID="LastName" runat="server" MaxLength="30" Width="160px"></asp:TextBox> Detail information for ID.
<%# Eval("Applicant_ID")%><br /><%
# Eval("First_Name") %> <%# Eval("MI") %><%
# Eval("Last_Name") %> <br /> <i>SSN:
<%# Eval("SSN") %> </i>--
%> <%# Eval("Address") %> <%# Eval("Address2") %><%
# Eval("City") %> <%# Eval("State") %><%
# Eval("Zip") %> <%# Eval("Zip4") %>Phone:
<%
# Eval("Phone") %> <%# Eval("Phone2") %> <br />Status:
<%
# Eval("Status") %><br />Comments:
<%# Eval("Comments") %>Detail information for ID.
<%# Eval("Applicant_ID")%><br /><%
# Eval("First_Name") %> <%# Eval("MI") %><%
# Eval("Last_Name") %> <br /> <i>SSN:
<%# Eval("SSN") %> </i> </b> <br /> <asp:LinkButton runat="server" Text="Update" Font-Underline="true" CommandName="Update" ID="lkbtnUpdate" /> <asp:LinkButton runat="server" Text="Cancel" Font-Underline="true" CommandName="Cancel" ID="lkbtnCancel" /> <hr />Phone:
<asp:TextBox Text='<%# Bind("Phone") %>' runat="server" ID="txtPhone" /> <asp:RegularExpressionValidator ID="ExpValPhone" runat="server" ControlToValidate="txtPhone" ErrorMessage="10 digits only." ValidationExpression="\d{10}"> </asp:RegularExpressionValidator>Status:
Comments:
<asp:TextBox Text='<%# Bind("Comments") %>' runat="server" ID="txtBox" Width="100%" MaxLength="80" TextMode="MultiLine" />Position applied for:
<br /> <asp:DropDownList ID="EditPosition" runat="Server" DataSourceID="dsPositions" DataTextField="Position_Name" DataValueField="Position_Code" selectedValue='<%# Bind("Position_Code") %>'> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> </Columns>--
%> <asp:parameter Name="Applicant_ID" Type="int32" /> <asp:parameter Name ="Phone" Type="String" /> <asp:parameter name="Status" Type="String" /> <asp:parameter name="Comments" Type="String" /> <asp:parameter name="Position_Code" Type="int16" /> </updateparameters> </asp:ObjectDataSource>CODES BEHIND:
public
partial class Dev_GridView_Update : System.Web.UI.Page{
private ApplicantDB db = new ApplicantDB();private HR_StatusDB dbs = new HR_StatusDB();{
//The data source needs // to be bound to the GridView control only when the // page is first loaded. Thereafter, the values are // stored in view state. if (!IsPostBack){
this.lblStatus.Text = DateTime.Now.ToString();MyGridView.DataBind();
}
}
protected void MyGridView_PageIndexChanging(object sender, GridViewPageEventArgs e){
//MyGridView.DataSource = SortDataTable(MyGridView.DataSource as DataTable, true);MyGridView.PageIndex = e.NewPageIndex;
MyGridView.DataBind();
}
protected void btnAddEmployee_Click(object sender, EventArgs e){
//Load Gridview: this.MyGridView.DataSourceID = "sourceApplicants";}
protected void MyGridView_Sorted(object sender, GridViewSortEventArgs e){
//Clear Selected index:MyGridView.SelectedIndex = -1;
}
//-------------retain SELECTED row:-------------------------------------------------- protected void MyGridView_SelectedIndexChanged(object sender, EventArgs e){
//Save the Selected value: int index = MyGridView.SelectedIndex;if (index != -1){
ViewState[
"SelectedValue"] = MyGridView.SelectedValue.ToString(); int ID = (int)MyGridView.SelectedDataKey.Values["Applicant_ID"]; string firstname = MyGridView.SelectedRow.Cells[2].Text; string lastname = MyGridView.SelectedRow.Cells[4].Text; string SSN = MyGridView.SelectedRow.Cells[5].Text; this.GridViewDetails.DataSourceID = "sourceAppDetails";}
//Retrieve selected Key Field:}
protected void MyGridView_DataBound(object sender, EventArgs e){
//Reapply the Selected value: if (ViewState["SelectedValue"] != null){
string selectedValue = (string)ViewState["SelectedValue"]; //Reselect the last selected row: foreach (GridViewRow row in MyGridView.Rows){
string keyValue = MyGridView.DataKeys[row.RowIndex].Value.ToString();if (keyValue == selectedValue){
MyGridView.SelectedIndex = row.RowIndex;
return;}
}
}
}
//----------END OF---retain SELECTED row:--------------------------------------------------{
DropDownList status = (DropDownList)(GridViewDetails.Rows[e.RowIndex].FindControl("EditStatus")); DropDownList position = (DropDownList)(GridViewDetails.Rows[e.RowIndex].FindControl("EditPosition")); //e.NewValues.Add("Position_ID", position.SelectedValue.ToString());}
}
Wednesday, September 26, 2007 3:09 PM -
User1181709163 posted
Hi Amensi, I have same problem with ObjectDataSource. I tried as u suggested but it didn't work. Pls suggest me solution...
Public Function getNews() As DataTable Dim cmd As New OracleCommand("", con) cmd.CommandText = "SELECT HEADLINE, PREVIEW_IMAGE, SHOW_PREVIEW, SHORT_DESC, DETAIL_NEWS, NEWS_DATE,Attachment,USER_ID, TIMESTAMP,ROWID AS ROWID1,disp_order FROM NEWS_LINK" Dim ds As New DataSet Dim da As New OracleDataAdapter(cmd) da.Fill(ds, "NEWS_LINK") Return ds.Tables(0) End Function Public Function insertData(ByVal HEADLINE As String, ByVal PREVIEW_IMAGE As String, ByVal SHOW_PREVIEW As Integer, ByVal SHORT_DESC As String, ByVal DETAIL_NEWS As String, ByVal NEWS_DATE As String, ByVal ATTACHMENT As String) As Boolean Dim cmd As New OracleCommand("", con) cmd.CommandText = "INSERT INTO NEWS_LINK (HEADLINE, PREVIEW_IMAGE, SHOW_PREVIEW, SHORT_DESC, DETAIL_NEWS, NEWS_DATE, USER_ID, TIMESTAMP, LOCATION, ATTACHMENT) VALUES('" & HEADLINE & "','" & PREVIEW_IMAGE & "'," & SHOW_PREVIEW & ",'" & SHORT_DESC & "','" & DETAIL_NEWS & "','" & NEWS_DATE & "','" & Session("EMPID") & "',SYSDATE,'None','" & ATTACHMENT & "')" Try If con.State = ConnectionState.Open Then Else con.Open() End If cmd.ExecuteNonQuery() Return True Catch ex As Exception End Try End Function Public Function updateData(ByVal ROWID1 As String, ByVal HEADLINE As String, ByVal PREVIEW_IMAGE As String, ByVal SHOW_PREVIEW As Integer, ByVal SHORT_DESC As String, ByVal DETAIL_NEWS As String, ByVal NEWS_DATE As String, ByVal ATTACHMENT As String) As Boolean Dim cmd As New OracleCommand("", con) cmd.CommandText = "UPDATE NEWS_LINK SET HEADLINE='" & HEADLINE & "',PREVIEW_IMAGE='" & PREVIEW_IMAGE & "',SHOW_PREVIEW=" & SHOW_PREVIEW & ",SHORT_DESC='" & SHORT_DESC & "',DETAIL_NEWS='" & DETAIL_NEWS & "',NEWS_DATE='" & NEWS_DATE & "',USER_ID='" & Session("EMPID") & "',TIMESTAMP=SYSDATE,LOCATION='None',ATTACHMENT='" & ATTACHMENT & "' WHERE ROWID='" & ROWID1 & "')" Try If con.State = ConnectionState.Open Then Else con.Open() End If cmd.ExecuteNonQuery() Return True Catch ex As Exception End Try End Function Public Function deleteData(ByVal ROWID1 As String) As Boolean Dim cmd As New OracleCommand("", con) cmd.CommandText = "DELETE NEWS_LINK WHERE ROWID='" & ROWID1 & "')" Try If con.State = ConnectionState.Open Then Else con.Open() End If cmd.ExecuteNonQuery() Return True Catch ex As Exception End Try End Function '=======End functions================ <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="deleteData" InsertMethod="insertData" SelectMethod="getNews" TypeName="TBL_News_Link" UpdateMethod="updateData" OldValuesParameterFormatString="Original_{0}"> <DeleteParameters> <asp:Parameter Name="ROWID1" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="ROWID1" Type="String" /> <asp:Parameter Name="HEADLINE" Type="String" /> <asp:Parameter Name="PREVIEW_IMAGE" Type="String" /> <asp:Parameter Name="SHOW_PREVIEW" Type="Int32" /> <asp:Parameter Name="SHORT_DESC" Type="String" /> <asp:Parameter Name="DETAIL_NEWS" Type="String" /> <asp:Parameter Name="NEWS_DATE" Type="String" /> <asp:Parameter Name="ATTACHMENT" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="HEADLINE" Type="String" /> <asp:Parameter Name="PREVIEW_IMAGE" Type="String" /> <asp:Parameter Name="SHOW_PREVIEW" Type="Int32" /> <asp:Parameter Name="SHORT_DESC" Type="String" /> <asp:Parameter Name="DETAIL_NEWS" Type="String" /> <asp:Parameter Name="NEWS_DATE" Type="String" /> <asp:Parameter Name="ATTACHMENT" Type="String" /> </InsertParameters> </asp:ObjectDataSource> '===============End ObjectDataSource============================ <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="ObjectDataSource1" DataKeyNames="ROWID1" AutoGenerateColumns="False"> <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" /> <Columns> <asp:TemplateField HeaderText="Disp_Order"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DISP_ORDER") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("DISP_ORDER") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="HEADLINE"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("HEADLINE") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("HEADLINE") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="PREVIEW_IMAGE"> <EditItemTemplate> <asp:FileUpload ID="FileUpload1" runat="server" Width="168px" /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Bind("PREVIEW_IMAGE") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="SHOW_PREVIEW"> <EditItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("SHOW_PREVIEW") %>' /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label4" runat="server" Text='<%# Bind("SHOW_PREVIEW") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="SHORT_DESC"> <EditItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("SHORT_DESC") %>' Width="208px"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label5" runat="server" Text='<%# Bind("SHORT_DESC") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="DETAIL_NEWS"> <EditItemTemplate> <asp:TextBox ID="TextBox4" runat="server" Height="104px" Text='<%# Bind("DETAIL_NEWS") %>' TextMode="MultiLine" Width="224px"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:TextBox ID="TextBox4" runat="server" Height="104px" Text='<%# Bind("DETAIL_NEWS") %>' TextMode="MultiLine" Width="224px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="NEWS_DATE"> <EditItemTemplate> <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NEWS_DATE") %>' Width="96px"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label6" runat="server" Text='<%# Bind("NEWS_DATE") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Attachment"> <EditItemTemplate> <asp:FileUpload ID="FileUpload2" runat="server" Width="192px" /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label7" runat="server" Text='<%# Bind("ATTACHMENT") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="ROWID"> <EditItemTemplate> <asp:Label ID="Label9" runat="server" Text='<%# Bind("ROWID1") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label8" runat="server" Text='<%# Bind("ROWID1") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> </Columns> <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" /> <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" /> <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" /> <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" /> <AlternatingRowStyle BackColor="#F7F7F7" /> </asp:GridView>
'====================================
Error Msg: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'deleteData' that has parameters: ROWID1, Original_ROWID1.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'deleteData' that has parameters: ROWID1, Original_ROWID1.] System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation) +1440 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +1338 System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +176 System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +914 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1067 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +214 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838
Thanks..
Tuesday, December 25, 2007 6:40 AM -
User1792234076 posted
Hi Everybody I have the same error (ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdatePre' that has parameters: Comp, Job_Number, Request_Date, Customer, Contact_Name, Tel, Email, Media, Job_Size, Colors, Number_of_Lots, Proof, Job_Detail, PrepressID) when I tried to update the values in my dataset. (before I had the problem to Insert and Delete and I changed OldValuesParameterFormatString="original_{0}" to OldValuesParameterFormatString="{0}" and it worked fine for Insert and Delete but I am still getting this error when I try to update values in my dataset with a Gridview).
I use a dataset (TableAdapter Prepress_Request_Form) connected to a MSDE Server and with a SQLOLEDB connection.
The PrimaryKey is PrepressID and my Methods of my dataset are the followings:
1)GetPre()
SELECT Prepress_Request_Form.*
FROM Prepress_Request_Form2)DeletePre()
DELETE FROM [Prepress_Request_Form] WHERE (([PrepressID] = ?))
3) InsertPre()
INSERT INTO [Prepress_Request_Form] ([Comp], [Job_Number], [Request_Date], [Customer], [Contact_Name], [Tel], [Email], [Media], [Job_Size], [Colors], [Number_of_Lots], [Proof], [Job_Detail]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4)UpdatePre()
UPDATE [Prepress_Request_Form] SET [Comp] = ?, [Job_Number] = ?, [Request_Date] = ?, [Customer] = ?, [Contact_Name] = ?, [Tel] = ?, [Email] = ?, [Media] = ?, [Job_Size] = ?, [Colors] = ?, [Number_of_Lots] = ?, [Proof] = ?, [Job_Detail] = ? WHERE (([PrepressID] = ?))
Here is my code:
<%
@ Page Language="VB" AutoEventWireup="false" CodeFile="Edit.aspx.vb" Inherits="Edit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html xmlns="http://www.w3.org/1999/xhtml" ><
head runat="server"> <title>Untitled Page</title></
head><
body> <form id="form1" runat="server"> <div> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeletePre" InsertMethod="InsertPre" OldValuesParameterFormatString="{0}" SelectMethod="GetPre" TypeName="TestTableAdapters.Prepress_Request_FormTableAdapter" UpdateMethod="UpdatePre"> <DeleteParameters> <asp:Parameter Name="PrepressID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Comp" Type="Int32" /> <asp:Parameter Name="Job_Number" Type="Int32" /> <asp:Parameter Name="Request_Date" Type="DateTime" /> <asp:Parameter Name="Customer" Type="String" /> <asp:Parameter Name="Contact_Name" Type="String" /> <asp:Parameter Name="Tel" Type="String" /> <asp:Parameter Name="Email" Type="String" /> <asp:Parameter Name="Media" Type="String" /> <asp:Parameter Name="Job_Size" Type="String" /> <asp:Parameter Name="Colors" Type="String" /> <asp:Parameter Name="Number_of_Lots" Type="String" /> <asp:Parameter Name="Proof" Type="String" /> <asp:Parameter Name="Job_Detail" Type="String" /> <asp:Parameter Name="PrepressID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Comp" Type="Int32" /> <asp:Parameter Name="Job_Number" Type="Int32" /> <asp:Parameter Name="Request_Date" Type="DateTime" /> <asp:Parameter Name="Customer" Type="String" /> <asp:Parameter Name="Contact_Name" Type="String" /> <asp:Parameter Name="Tel" Type="String" /> <asp:Parameter Name="Email" Type="String" /> <asp:Parameter Name="Media" Type="String" /> <asp:Parameter Name="Job_Size" Type="String" /> <asp:Parameter Name="Colors" Type="String" /> <asp:Parameter Name="Number_of_Lots" Type="String" /> <asp:Parameter Name="Proof" Type="String" /> <asp:Parameter Name="Job_Detail" Type="String" /> </InsertParameters> </asp:ObjectDataSource></
body></
html>Any Idea please will be very appreciated.
Thank you very much!!
Thursday, January 17, 2008 12:37 PM -
User916267233 posted
I encountered the same issue with my update on a datagrid that uses an ODS with SPs. The work around for me is as follows:
-
confiure the existing table adapter
-
first select the Use SQL statements
-
then click on Advanced Options
-
uncheck the Refresh the Data Table
-
click OK then click Previous
-
Select use existing SPs
-
Verify you have the correct SPs then click Finish
Please note, I have an existing TA with SPs. So I just had to reconfigure using the above. This workaround may not be typical and therefore may not work for you.
Sunday, March 2, 2008 3:40 PM -
-
User-133155790 posted
Unfortunately none of the above is working for me.
Firstly I'm not sure that the lingo I'm using is right but I'll try
I have a FormView contol that has an ObjectDataSource. This is plugged into my BLL that accesses the DAL. The DAL is configured to use existing Stored Procedures.
When I try to do a delete I get this error message:
ObjectDataSource 'ObjectDataSourceModules' could not find a non-generic method 'ModuleDelete' that takes parameters of type "myBusinessLogicLayer.Module'.
This is the code in the BLL:
public static void ModuleDelete(string moduleCode){
using (ModulesTableAdapter db = new ModulesTableAdapter()){
db.ModuleDelete(moduleCode);
}
}
The ObjectDataSource has a propertyDataObjectTypeName
="myBusinessLogicLayer.Module"If I the delete that property I get a new error:
ObjectDataSource 'ObjectDataSourceModules' could not find a non-generic method 'ModuleDelete' that has parameters: moduleCode, Code.
I'm only passing one parameter as declared in the ObjectDataSource:
<
DeleteParameters> <asp:Parameter Name="moduleCode" Type="String" /> </DeleteParameters>My stored procedure has a primary key that is not auto incremented but it's set to read only false in the edit template
ALTER PROCEDURE [dbo].[ModuleDelete]@Code
nvarchar(50)AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DELETE FROM Modules WHERE Code = @CodeEND
SOrry for the essay but I'm on day 3 with this now.
I really like the idea of separating the DAL from the presentation layer but I could write my own Data Access code with much less fuss.
If anyone can help I would be very grateful
J
Tuesday, April 8, 2008 11:43 AM -
User1013147109 posted
wow, its working :) thanks
Thursday, May 8, 2008 4:36 AM -
User1756919671 posted
I would not call this a bug in Visual Studio as much as something misleading.
I found the following to be the neatest way to fix the problem while keeping everything else logical. That means I did not add a meaningless parameter (that will not be used) to my update method nor change the ReadOnly property of the Id to False.
I kept my function as it is. [ex. public bool UpdateText(string text, int id)] and I went to the ObjectDataSource's UpdateParameters collection and removed the Id parameter. Then I change the format of the old value parameter to only {0} (this way {0} will be id instead of original_id) and it worked. The GridView update called my update function correctly passing it the correct parameters.
I hope this will help someone else who's stuck.
Sunday, May 11, 2008 6:17 AM -
User1741680510 posted
I cant see Advanced Options.
I created a dataset by adding a new and using a stored proc, but I cant see the Advanced Options you mentioned. Your reply sounds logical, but I dont know what you mean.
J
Thursday, July 17, 2008 10:19 AM -
User-1429651324 posted
The real problem with this error message is that it is too broad.
When I added my Update method to my TableAdapter in my XSD using the TableAdapter Query Configuration tool, the tool inexplicably dropped one of my input parameters.
Tuesday, July 22, 2008 5:26 AM -
User573851430 posted
now im going back again.. the same old errors are circling around as i follow those steps..
sigh :( .. though some had work but the prob now is the GUID it return 0000-00000-000 sigh! it is really getting boring after a week of finding the solution.
Wednesday, September 24, 2008 10:08 AM -
User953821505 posted
Well just to add to the collective wisdom. I was running across this same error, tried the suggested fixes to no avail. After running through that gamut, I followed a suspicion that I had.
The table I was working with had field names that started with Original_ (in this case Original_Source and Original_Value). When the Update statement is created – those fields are called p1 and p4 (in my case - your mileage may vary), I figured that this substitution would be followed through “behind the scenes”. Wrong.
When I exclude those fields from the tableadapter query (select blah blah from table) hey presto all is happy again. I can rebuild my screens and get on with it.
So I’ll speculate that Visual Studio has made up its mind that only it’s allowed to use fields that start with “Original_” . If there is a scheme to substitute the user-define fields – to avoid the ridiculous restriction that “While working through the UI for tableadapters you’re not allowed to use fields that start with Original_” – then it doesn’t work.
Whether this ridiculous – but present – restriction requires the use of an underscore and I would’ve missed the educational opportunity had the fields been named OriginalSource and OriginalValue – I’ll never know. Unless someone wishes to further explore this behavior and post the results.
Thursday, March 26, 2009 12:28 PM -
User-1924666908 posted
I am also getting following error:
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateQuery' that has parameters: Region, EID_No, MasterEIDNo, Exchg, Bldg_ID, Block, Section, Plot, p1, Obj_No, OLT, FDH, p4, Building, Owner, ResTenants, BzTenants, TenantUpdateOn, Status, PECNo, CreatedOn, Active, EID No, Bldg ID, DP/IFP, Obj No, Bldg/Villa, FTTHID.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="{0}" SelectMethod="GetDataBy" TypeName="dstFtthDataTableAdapters.FTTHDataTableAdapter" UpdateMethod="UpdateQuery"> <DeleteParameters> <asp:Parameter Name="Original_FTTHID" Type="Int32" /> <asp:Parameter Name="Original_Region" Type="String" /> <asp:Parameter Name="Original_EID_No" Type="String" /> <asp:Parameter Name="Original_MasterEIDNo" Type="String" /> <asp:Parameter Name="Original_Exchg" Type="String" /> <asp:Parameter Name="Original_Bldg_ID" Type="String" /> <asp:Parameter Name="Original_Block" Type="String" /> <asp:Parameter Name="Original_Section" Type="String" /> <asp:Parameter Name="Original_Plot" Type="String" /> <asp:Parameter Name="p2" Type="String" /> <asp:Parameter Name="Original_Obj_No" Type="String" /> <asp:Parameter Name="Original_OLT" Type="String" /> <asp:Parameter Name="Original_FDH" Type="Double" /> <asp:Parameter Name="p5" Type="String" /> <asp:Parameter Name="Original_Building" Type="String" /> <asp:Parameter Name="Original_Owner" Type="String" /> <asp:Parameter Name="Original_ResTenants" Type="Int32" /> <asp:Parameter Name="Original_BzTenants" Type="Int32" /> <asp:Parameter Name="Original_TenantUpdateOn" Type="DateTime" /> <asp:Parameter Name="Original_Status" Type="String" /> <asp:Parameter Name="Original_PECNo" Type="String" /> <asp:Parameter Name="Original_CreatedOn" Type="DateTime" /> <asp:Parameter Name="Original_Active" Type="Boolean" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="EID_No" Type="String" /> <asp:Parameter Name="MasterEIDNo" Type="String" /> <asp:Parameter Name="Exchg" Type="String" /> <asp:Parameter Name="Bldg_ID" Type="String" /> <asp:Parameter Name="Block" Type="String" /> <asp:Parameter Name="Section" Type="String" /> <asp:Parameter Name="Plot" Type="String" /> <asp:Parameter Name="p1" Type="String" /> <asp:Parameter Name="Obj_No" Type="String" /> <asp:Parameter Name="OLT" Type="String" /> <asp:Parameter Name="FDH" Type="Single" /> <asp:Parameter Name="p4" Type="String" /> <asp:Parameter Name="Building" Type="String" /> <asp:Parameter Name="Owner" Type="String" /> <asp:Parameter Name="ResTenants" Type="Int32" /> <asp:Parameter Name="BzTenants" Type="Int32" /> <asp:Parameter Name="TenantUpdateOn" Type="DateTime" /> <asp:Parameter Name="Status" Type="String" /> <asp:Parameter Name="PECNo" Type="String" /> <asp:Parameter Name="CreatedOn" Type="DateTime" /> <asp:Parameter Name="Active" Type="Boolean" /> <asp:Parameter Name="FTTHID" Type="Int32" /> </UpdateParameters> <SelectParameters> <asp:Parameter Name="FTTHID" Type="Int32" /> <asp:ControlParameter ControlID="lstRegion" Name="Region" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="txtEID" Name="EIDNo" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="txtExchange" Name="Exchg" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="lstSector" Name="Block" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="txtSection" Name="Section" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="txtPlot" Name="Plot" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="txtOLT" Name="OLT" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="txtFDH" Name="FDH" PropertyName="Text" Type="Single" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="EID_No" Type="String" /> <asp:Parameter Name="MasterEIDNo" Type="String" /> <asp:Parameter Name="Exchg" Type="String" /> <asp:Parameter Name="Bldg_ID" Type="String" /> <asp:Parameter Name="Block" Type="String" /> <asp:Parameter Name="Section" Type="String" /> <asp:Parameter Name="Plot" Type="String" /> <asp:Parameter Name="p1" Type="String" /> <asp:Parameter Name="Obj_No" Type="String" /> <asp:Parameter Name="OLT" Type="String" /> <asp:Parameter Name="FDH" Type="Double" /> <asp:Parameter Name="p4" Type="String" /> <asp:Parameter Name="Building" Type="String" /> <asp:Parameter Name="Owner" Type="String" /> <asp:Parameter Name="ResTenants" Type="Int32" /> <asp:Parameter Name="BzTenants" Type="Int32" /> <asp:Parameter Name="TenantUpdateOn" Type="DateTime" /> <asp:Parameter Name="Status" Type="String" /> <asp:Parameter Name="PECNo" Type="String" /> <asp:Parameter Name="CreatedOn" Type="DateTime" /> <asp:Parameter Name="Active" Type="Boolean" /> </InsertParameters> </asp:ObjectDataSource>
Please do something on urgent basis.Monday, December 28, 2009 4:54 AM -
User-706647060 posted
What a great post ! this perfect and exactly what I needed ! thanks man ! I am thankful for your help :)
Tuesday, August 10, 2010 7:06 AM -
User-176362023 posted
great post!!! I should have google searched earlier. :) Thank you very much.
Tuesday, August 16, 2011 6:34 PM -
User-53792099 posted
You must ensure your parameter names match in all places. If you see this error: ObjectDataSource could not find a non-generic method that has parameters. Odds are yours id's do not match up in all places.
you can see my Asp.net Article in this site Codevc.com
Here's an example, Notice the id 'ScheduleId' used in the grid, ods paramters and data access function
<asp:GridView ID="uxgvSchedule" DataKeyNames="ScheduleId" ...
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="lblDeleteSchedule" runat="server" CommandName="Delete" Text="Delete" CommandArgument="<%# CType(Container, GridViewRow).RowIndex %>" />
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
<asp:ObjectDataSource ID="odsSchedule" DeleteMethod="DeleteSchedule" OnDeleting="odsSchedule_Deleting" ... />
<DeleteParameters>
<asp:Parameter Name="ScheduleId" Type="Int32" />
</DeleteParameters>
Protected Sub uxgvSchedule_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles uxgvSchedule.RowCommand
Try
Dim tempInt As Integer
If Integer.TryParse(e.CommandArgument, tempInt) Then
Dim row As GridViewRow = uxgvSchedule.Rows(Convert.ToInt32(e.CommandArgument))
Dim rowkey As DataKey = uxgvSchedule.DataKeys(row.RowIndex)
uxlblScheduleId.Text = rowkey.Value
End If
Catch ex As Exception
End Try
End Sub
Protected Sub odsSchedule_Deleting(ByVal sender As Object, ByVal e As ObjectDataSourceMethodEventArgs) Handles odsSchedule.Deleting
************VERY COMMON CAUSE - FIX ******************
'e.InputParameters("ScheduleId") = uxlblScheduleId.Text
'2nd time i ran into this problem the error was indicating more
'than one parameter or a completely different set of parameters,
'so I would nearly do this instead from now on in this function
e.InputParameters.Clear()
e.InputParameters.Add("ScheduleId", uxlblScheduleId.Text)
End Sub
Public Function DeleteSchedule(ByVal ScheduleId As Integer) As Integer
Dim rowsAffected As Integer = 0
Dim con As SqlConnection = New SqlConnection(connectionString)
Dim cmd As SqlCommand = New SqlCommand("DeleteSchedule", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@ScheduleId", SqlDbType.Int))
cmd.Parameters("@ScheduleId").Value = ScheduleId
Try
con.Open()
rowsAffected = cmd.ExecuteNonQuery()\Thursday, August 18, 2011 3:23 PM