DataSource Controls :: ObjectDataSource 'odsDetail' Could Not Find A Non-generic Method 'Update'...
Jan 26, 2011
I try to update the detailview control. got this error messsage.
ObjectDataSource 'odsDetail' could not find a non-generic method 'Update' that has parameters: hospitalID, hospitalName, taxID, address1, address2, city, state, zip.
error "ObjectDataSource 'ObjectDataSourceCaseDetails' could not find a non-generic method". I have an update method and my ObjectDataSource is hooked up to the method in my BLL. review my code below
public DataTable GetBrokers(bool? hasImport=null) { SqlCommand cmd = new SqlCommand("usp_GetBrokers"); if (hasImport.HasValue) cmd.Parameters.AddWithValue("@hasImport", hasImport); return FillDataTable(cmd, "brokers"); }
When the form loads I get this error:
ObjectDataSource 'srcBrokers' could not find a non-generic method 'GetBrokers' that has no parameters.
Is it my optional parameter that is causing the problem? How can I workaround this? Is it possible to have optional parameters with declarative ASP.NET code?
I am binding dropdown list using Object data source. I got an error like this
"ObjectDataSource 'objDSStatus' could not find a non-generic method 'GetIssueAllowedStatusByCategoryIDStatusIDandUserType' that has parameters: IssueCategoryID."
My code is as follows .aspx
< asp:DropDownList ID="ddlStatus" runat="server" DataSourceID="objDSStatus" DataTextField="IssueStatusName" DataValueField="IssueStatusID"> < /asp:DropDownList> < asp:ObjectDataSource ID="objDSStatus" runat="server" TypeName="DA"></asp:ObjectDataSource> .cs private void Bind(int IssueCategoryID, int IssueStatusID, int UserType) { ddlStatus.Items.Clear(); objDSStatus.SelectMethod = "GetIssueAllowedStatusByCategoryIDStatusIDandUserType"; objDSStatus.SelectParameters.Clear(); objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString()); objDSStatus.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString()); objDSStatus.SelectParameters.Add("UserType", UserType.ToString()); objDSStatus.DataBind(); ddlStatus.DataBind(); } DA.cs public List<IssueStatus> GetIssueAllowedStatusByCategoryIDStatusIDandUserType(int IssueeCategoryID, int IssueStatusID, int UserType) { List<IssueStatus> issueStatusList = new List<IssueStatus>(); }
I'm a starting C# programmer and I'm experiencing the following problem.I've created a dataset in Visual Studio With a table for persons making use of two table adapters, one for selecting all persons and one for selecting one person at a time filtered by the personID (Guid). This is a seperate project of my solution. After that I created a new project for the Business Logic Layer
private PersonenTableAdapter personenAdapter = null; protected PersonenTableAdapter Adapter {get....} [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, true)] public DAL.Testdatabase.PersonenDataTable GetPersonen() {...} [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)] public DAL.Testdatabase.PersonenDataTable GetPersonenByID(Guid ID) {...} [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)] public bool updatePersoon(string Voornaam, string Achternaam, string Geslacht, string Adres, string Huisnr, string Postcode, string Plaats, string Telnr, string GSM, string BSN, DateTime? CreateDate, string CreatedBy, DateTime? LastModifiedDate, string LastModifiedBy, bool? Actief, DateTime? DatumInactief, Guid ID) {...} When issueing the Update method using a detailsview with an Objectdatasource i get the following error. ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'updatePersoon' that has parameters: Voornaam, Achternaam, Geslacht, Adres, HuisNr, Postcode, Plaats, Telnr, GSM, BSN, CreateDate, CreatedBy, LastModifiedDate, LastModifiedBy, Actief, DatumInactief, original_ID.
I am getting error : ObjectDataSource 'ObjectDataSource1' could not find a non-generic method What would be the possible cause / solution for this error.This error is coming when call below method ObjectDataSource1.SelectMethod = "MethodName"// thr r some more code after that, although not much irrelevant en call Server.Transfer("NewPage.aspx", True);
Now i can populate my gridview trough code by this: //gvwDiensten.DataSource = new BindingList<diensten>(dataManager.GetList<diensten>().ToList());But i would like to use an objectdatasource, so i created this:
[Code]....
</asp:ObjectDataSource>
But when running the page i get:
ObjectDataSource 'dsDiensten' could not find a non-generic method 'GetList' that has no parameters.
I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):
Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating Dim entity As New Login() Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo) entity = accountControl.Entity e.InputParameters.Add("entity", entity) End Sub
My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:
Public Overloads Function Update(ByVal entity As Login) If entity Is Nothing Then Throw New ArgumentNullException("entity") End If MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _ entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax) End Function
When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?
I bind this to a GridView but I'm not looking to edit row by row. Instead my GridView has a bunch of TemplateFields with textboxes. I also have a Button that when pressed, invokes the Update method of the ODS. So then the "UpdateTestData" function in my TestBLL is called. This looks like this:
public void UpdateTestData(MyTestDataTable dt) { QueriesTableAdapter qta = new QueriesTableAdapter(); qta.UpdateTestData(dt); }
At run-time in debug, it seems like the object for the signature above is not populated with the data from my GridView.
Most likely the later, I think. In my page I have a GridView, DatailsView, and the ODS. None of my commands work. For the Udate command I get a an error "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateVirtual' that has parameters: name, notes, active, original_ident." For the Delete command I get "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'DeleteVirtual' that has parameters: ident, original_ident." Yet the Insert command in the DetailsView works fine. Originally I've copied a file that performs virtually identical task, the only difference is a different database and the Select command. I had the Delete command working for for while but that one too broke. Can someone point out what I'm doing wring?
My Business Logic Layer has AddItem method that add's to Items table in db along with an entry in Balance table.AddItem method uses two TableAdapters Items & Balance. Both these have corresponding Business Objects as Item and Balance.
Here is the AddItem method :
[Code]....
ASPX Page with DetailsView & ObjectDataSource
[Code]....
Now executing this page generates error as
ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddItem' that has parameters: _item, _balance, ItemName, GroupId, CategoryId, AuId, Rate, TotalStrScale, OffsStrScale, OffsAE [code]...
I am using a gridview to select a record and control that record using a details view. I am using a class based objectdatasource to link the data for select, update and delete. Sofar the select works but the update fails. Here is my error message:
ObjectDataSource 'odsDetailsView_1' could not find a non-generic method 'UpdateSet' that has parameters: setId, TYPE, iHPlayer, iAPlayer, iHRuns, iARuns, iH8Break, iA8Break, iHe8s8, iAe8s8, iH15BRn, iA15BRn, iHWins, iAWins, SET_ID, MATCH_FK, HOME_MEMBER_ID_FK, AWAY_MEMBER_ID_FK, HOME_TABLERUN, AWAY_TABLERUN, HOME_8BALLBREAK, AWAY_8BALLBREAK, HOME_E8S8, AWAY_E8S8, HOME_15BRN, AWAY_15BRN, HOME_TOTALWON, AWAY_TOTALWON, HOME_POINTS, AWAY_POINTS, LOCKED, GROUP_FK.
The first group of parameters have lower case letters and they come from my objectdatasources update method parameters. The second group of parameters are all capitalized and they are the fields in my SQL database table (and I don't know how they wound up in the error). This might be a clue.When executing the code my class method never gets the chance to execute because the error pops up before the code gets there.
I am very new to updating the datasource using ObjectDatasource. I have a checkbox on click of update the update method triggers but though teh check box is checked, the value is updated as false.
The problem is when I use Guid UserId = Guid.NewGuid ();.
In Table I UserId type: unique Therefore it does not work. If I use the UserId type: int working.
Error: ObjectDataSource 'ProductsOptimisticConcurrencyDataSource' could not find a non-generic method 'DeleteProduct' that has parameters: ID, UserId.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ObjectDataSource 'ProductsOptimisticConcurrencyDataSource' could not find a non-generic method 'DeleteProduct' that has parameters: ID, UserId.
How and where can I get the returnvalue from my "DeleteGuestById" method to show the right error message to my user?
I have this:
Protected Sub gvGuestlist_OnRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvGuestlist.RowCommand If e.CommandName = "DeleteGuest" Then Dim index As Integer = Convert.ToInt32(e.CommandArgument) Dim data As DataKey = gvGuestlist.DataKeys(index) Dim GuestId As Integer = data.Values("id") odsGuestlist.DeleteParameters.Clear() odsGuestlist.DeleteParameters.Add("id", GuestId) odsGuestlist.Delete() End If End Sub
In my BLL:
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, False)> Public Function DeleteGuestById(ByVal ID As Integer) As Integer Dim returnval As Integer GuestlistAdapter.DeleteGuestById(ID, returnval) Return returnval End Function
I think I have to be in the ObjectDatasources' "OnDeleted" method but I have no what code to place there.
In my application at some places we have used ObjectDataSource and at other normal method calls to retrieve data.My question is then what exactly are the benefits of using ObjectDataSource ?In the example below "CODE ONE" makes a call to the Business Layer and then Binds the results to the Grid abd "CODE TWO" is using ObjectDataSource to do the same.Then how is ObjectDataSource better?
SuitableApplicant sa = new SuitableApplicant(); IList<HD.Recruitment.SuitableApplicant> list = new List<HD.Recruitment.SuitableApplicant>(); list = HS.Recruitment.RecruitmentService.GetSuitableAppls(); GridView1.DataSource = list; [code]....
http://msdn.microsoft.com/en-us/library/ms178538(VS.80).aspx ?I tried and got error as below, at clicking Update button in detailView
'/CaseExamples' 응용 프로그램에 서버 오류가 있습니다. ==> Server error in application program ObjectDataSource 'EmployeeDetailsObjectDataSource'에서 매개 변수 (LastName, FirstName, Address, City, Region, PostalCode, original_FirstName, original_LastName, original_Address, original_City, original_Region, original_PostalCode, original_EmployeeID)를 사용하는 네릭이 아닌 UpdateEmployee' 메서드를 찾을 수 없습니다.
I'm attempting to develop an n-tier web application that makes use of the ObjectDataSource on a page. The page shows the classic 'user details' page to allow create, read, update and delete actions for an object within the users collection. Let me explain that again as I think it might be the root of my issue. I have a class named 'user', I also have a class named 'users' which exposes a list of 'user' objects. It's this 'users' class that is the source of my ObjectDataSource control.
What i'm hoping to have happen is that the page will display a 'user' object from the 'users' class (which it does) and that the end user can then amend the values in a formview before updating them (it kind of does this). The problem I'm running into is that all the 'user' objects are getting updated with th ealtered values and not just the currently displayed object. I suspect that this has something to do with the web being stateless, but i'm going 'round in circles trying to figure out where i'm going wrong.
I can post code if required, but what i'm looking for is a decent (read as: easy to follow/understand) site where I can get a better understanding of what i'm supposed to be doing.
My environment is VS2010, C#, .NET 2.0, but I don't think the environment is the issue, merly the chair-keyboard interface.
i have an instance of ObjectDataSource with specified update method. But on update i have an old values(previously set in gridview) in method - they are not updating.
I have a datarepeater control on my form. I have a method for updating comments, but I would like it to be exectued when a user clicks a checkbox (inside the datarepeater). The checked value is being "bind" to the checkbox control. Can I use the built in Update Method tied to the objectdatasource?