DataSource Controls :: Update Method In ObjectDataSource Is Not Working?

Mar 9, 2010

Here is the "Update" method which is not updating.

It works if I remove "@original_UnitPrice" and "@original_OnHand" parameters from the "WHERE" clause.

[Code]....

View 2 Replies


Similar Messages:

DataSource Controls :: ObjectDataSource - Update Method To Pass Entity To The Method In BLL Class?

Oct 18, 2010

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

And here's the markup for the datasource:

<asp:ObjectDataSource ID="MasterDataSource" runat="server" EnableCaching="true" CacheDuration="10"
SelectMethod="SelectAll" UpdateMethod="Update" TypeName="Data.DAL.LoginDAL">
</asp:ObjectDataSource>

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?

View 1 Replies

DataSource Controls :: ObjectDataSource Could Not Find A Non - Generic Method Update?

Mar 11, 2010

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

[Code]....

[Code]....

View 1 Replies

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.

[Code]....

here's my edit function

[Code]....

View 3 Replies

DataSource Controls :: Use An ObjectDataSource Update Method With A Table - Valued Parameter?

Oct 13, 2010

I'm trying to figure out if it's possible to use an ObjectDataSource Update method with a table-valued parameter. Here's my ODS:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DataObjectTypeName="TestProject.MyTestDataTable"
SelectMethod="GetTestData" TypeName="TestProject.BLL.TestBLL"
OldValuesParameterFormatString="original_{0}"
UpdateMethod="UpdateTestData">
<SelectParameters>
<asp:Parameter DefaultValue="65" Name="testId" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

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.

View 1 Replies

DataSource Controls :: BLL Add Method & ObjectDataSource?

Jan 4, 2011

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]...

View 1 Replies

Forms Data Controls :: DetailsView's ObjectDataSource Update Method Fails?

Jan 15, 2011

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.

Here is my objectdatasource:

[Code]....

Here is my detailsview:

[Code]....

Here is my class update method constructor:

[Code]....

View 1 Replies

Forms Data Controls :: Updating Checkbox Value Through ObjectDataSource Update Method

Jan 4, 2011

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.

<asp:TemplateField HeaderText="IsPrimary" SortExpression="IsPrimary">
<EditItemTemplate>
<asp:CheckBox runat="server" ID="chkIsPrimary" Checked='<%# Eval("IsPrimary") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<EditItemTemplate>
<asp:TextBox ID="txtRemarks" runat="server" SkinID="longTextBox" TextMode="multiLine"
Text='<%# Bind("Remarks") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>......................

View 2 Replies

DataSource Controls :: How Use The Select Method To Get The Rowcount With Objectdatasource

Mar 22, 2010

i have this class

class MyDal
{
IList<MyData> GetAll(string orderBy, , int count, int firstIndex, out int totalRowCount);
}

i'm using an objectdatasource with MyDal to bind values to a gridview.

i want know if there's a way to configure the objectdatasource to use the parameter totalRowCount without calling the SelectCountMethod.

View 3 Replies

DataSource Controls :: Custom Insert Method In ObjectDataSource?

Jan 19, 2010

I've an ObjectDataSource & its datasource from typed dataset which is bind to 3 textboxes.

One of that textbox text concatenate with other two textboxes values.

Some thing like this,

textbox1.text=textbox2.text & textbox3.text

How can I customize my insert query for this?

I could not see the insert query in my objectdatasource.

View 4 Replies

DataSource Controls :: Getting Returnvalue From Objectdatasource Delete Method?

Jul 13, 2010

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.

View 2 Replies

DataSource Controls :: Benefits Of Using ObjectDataSource Over Normal Method Calls?

Jul 6, 2010

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]....

View 5 Replies

DataSource Controls :: Objectdatasource With A Generic Select Method - How To Pass The Type

Mar 14, 2011

[Code]....

[Code]....

The GetList method is as folllowing:

[Code]....

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.

View 5 Replies

DataSource Controls :: ConflictDetection In ObjectDataSource Is Not Working?

Mar 10, 2010

I am trying to update record in GridView. But ObjectDataSource is creating original_{0} and new vlaue object (exactly the same).ObjectDataSource.UpdateMethod is as follows

[Code]....

The paremeters ("original_ProductBO" and "productBO") in the above function are supposed to have different values since I am editing record in GridView and then updating it.I have the checked the query by hard coding parameter values and it works. In the ObjectDataSource_Updating(..) event, I cheked the parameters ("original_ProductBO" and "productBO") , I am getting the same values. Can anyone tell why tow parameters have the same values when I am editing record in GridView Code for the ObjectDataSourec and GridView is attached below

[Code]....

[Code]....

View 3 Replies

DataSource Controls :: ObjectDataSource Update With Parameters?

Feb 16, 2010

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' 메서드를 찾을 수 없습니다.

View 3 Replies

DataSource Controls :: ObjectDataSource And Update Confusion

May 16, 2010

Hi,

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.

Thanks,

Mike

View 13 Replies

ObjectDataSource Calls Update Method With Old Values?

Jun 20, 2010

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.

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeletePayment"
InsertMethod="InsertPayment" SelectMethod="GetPayments" TypeName="CostsReportControl.Models.Payments"
UpdateMethod="UpdatePayment" OldValuesParameterFormatString="{0}_old">
<SelectParameters>
<asp:Parameter Direction="input" Type="string" Name="sortExpression" />
<asp:Parameter Direction="input" Type="string" Name="sortDirection" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetList" TypeName="CostsReportControl.Models.PaymentTypes">
</asp:ObjectDataSource>

my update method

public void UpdatePayment(int Id,string Fullname,DateTime Date, string Sum, string PaymentType, string RecordInfo,int Id_old)

View 2 Replies

Forms Data Controls :: Update Method Objectdatasource And Data Repeater

Jan 4, 2010

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?

View 1 Replies

DataSource Controls :: ObjectDataSource / An Insert,select,Delete And Update Methods Being Referenced?

Jan 31, 2011

I am using an objectDataSource for the first time. My objectDatasource looks like this:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="CustomerData"
DataObjectTypeName="Customer" DeleteMethod="DeleteCustomer" InsertMethod="InsertCustomer"
SelectMethod="GetCustomersByObject" UpdateMethod="UpdateCustomer" OldValuesParameterFormatString="original_

[code]...

View 1 Replies

Update Using Objectdatasource Via Class And Dataset Not Working?

Jul 22, 2010

i try to update the gridview i keep on getting the error like objectdatasource could not find a non generic method 'update' which has parameters a,b,c etc.i have done everything right but i cant seem to figure this one out.i am using objectdatasource,a class file and a dataset.xsd file.

[code]...

View 2 Replies

DataSource Controls :: Update Method Using SQL To Entities

Apr 14, 2010

I'm having a question about an update method using SQL To Entities. I'm sending an object to the class and i'm updating him sucefully, but i need to specify each property of object instead of update in once. For example

[Code]....

In this case, i'm updating name, age and country sucefully but i want to use instead of update each property one-by-one, something like this:

[Code]....

So, the C = New should fill the C with all New values on properties, but this isn't work. To update an object, i've to update each property individual or can i update all in one like C = New?

View 3 Replies

DataSource Controls :: DataAdapter Update Method?

Feb 19, 2010

i am having a datatable with 10 rows.

Out of this 10 rows 3 Rows have their RowState as Added, 2 rows as Modified, and 4 as Deleted.

Now i want to use Datadapter's InsertCommand, UpdateCommand and DeleteCommand

Is it possible to update datatable's changes to Database with Single DataAdpater.Update(DataTable) Call.

Means i will call DataAdapter.Update(DataTable) method only once and with this all new added rows should be inserted in database, modified rows should be updated and deleted rows should be deleted from Database.

View 3 Replies

DataSource Controls :: How To Add Rows To Datatable And Use Sqldataadapter Update Method

Jan 24, 2010

I'm trying to add new rows to a data table and then use the sqldataadapter update method bu fund some problems. First, I written this code:

[Code]....

Excuse me but the most part of variable are in italian, however I think it is possible to understand how does it work. If I execute this code I obtain this error:

System.InvalidOperationException: Update requires a valid InsertCommand when passed DataRow collection with new rows.

After this I added these lines of code just above the last line:

SqlCommandBuilder cb = new SqlCommandBuilder(adapter);
adapter.InsertCommand = cb.GetInsertCommand;

and I obtained this error:

Cannot convert method group 'GetInsertCommand' to non-delegate type 'System.Data.SqlClient.SqlCommand'. Did you intend to invoke the method?

View 2 Replies

Forms Data Controls :: DetailsView Delete Method Passing Null Values To Objectdatasource Underlying Object Delete Method

Apr 12, 2010

I am using VS 2008 SP1. My also have included CSS Friendly adapter [URL] in my project ( I mentioned this because my GridView Empty data template is not showing when using GridView's CCS Friendly adapter). I have a GridView and a DetailsView. When a record in GridView is selected its details information is shown in the Details View. Type of Data source I am using is ObjectDataSource. My Insert and Update methods works perfectly. It is only the Delete method that is passing null values to the underlying object delete method. My source codes for both the UI, BLL, DAL is shown below

[Code]....

My Business Object code is below :

[Code]....

My Data Access Layer Code is:

[Code]....

View 2 Replies

DataSource Controls :: Update Record Not Working?

Jun 17, 2010

I am not sure if I am in the right spot here because this really doesn't have to do any datacontrol but hopefully somone can give me a hand with this.

Basically I have a bunch of TextBox controls on a page that are displaying the data I want but when I try to run an UPDATE query on the record I get nothing. The record values don't update and I don't appear to get any exceptions.....I am actually kinda really baffled on this one, here is what I have for the update code: [Code]....

Btw, if there is an easier way to do this with a control I am up for suggestions as I am just going off of some of my old VB6 ways

View 20 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved