473,883 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET 2.0 ObjectDataSourc e UpdateMethod not passing new values

Hello,

I started working with the ObjectDataSourc e today. I have the select,
and have been working on getting the update method to work. Here is
the asp code for my Data source:

<asp:ObjectData Source ID="dsourceApps " runat="server"
SelectMethod="g etAllApplicatio ns"
TypeName="AppMg r.AppManager" UpdateMethod="u pdateAppHdr"
ConflictDetecti on="CompareAllV alues"
OldValuesParame terFormatString ="{0}_old"
OnObjectCreatin g="dsourceApps_ OnObjectCreatin g"
OnObjectDisposi ng="dsourceApps _OnObjectDispos ing">
<UpdateParamete rs>
<asp:Paramete r Name="appid" Type="String" />
<asp:Paramete r Name="appname" Type="String" />
<asp:Paramete r Name="apploc" Type="String" />
<asp:Paramete r Name="appdesc" Type="String" />
<asp:Paramete r Name="appid_old " Type="String" />
<asp:Paramete r Name="appname_o ld" Type="String" />
<asp:Paramete r Name="apploc_ol d" Type="String" />
<asp:Paramete r Name="appdesc_o ld" Type="String" />
</UpdateParameter s>
</asp:ObjectDataS ource>
The function sig for the updateAppHdr function is:

public void updateAppHdr(st ring appid, string appname, string apploc,
string appdesc, string appid_old, string appname_old, string
apploc_old, string appdesc_old)

The error that I get after I hit the save button after editing a field
in my GridView is:

Exception Details: System.Data.Ora cleClient.Oracl eException: ORA-06550:
line 1, column 7:
PLS-00306: wrong number or types of arguments in call to
'ND_UPD_DEFINED _APP'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I did some digging, and I'm noticing that all the new values (the
fields without "_old" appended) are coming into the function as NULL.
The old values are coming in properly, but the new values are just
null...

Any ideas why this is happening? It's actually getting into the
function, so I'm guessing it has something to do with the way the
gridview is setup... I can't seem to find anything on this on google,
or maybe I'm just not sure what to look for...

Thanks in advance for any help,
Mike

Jan 20 '06 #1
13 8234
In the UpdateAppHdr function can you try setting the values to defaults (if
they were null) before passing them to Oracle and see if that eliminates the
ORA exception?

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"an*******@gmai l.com" wrote:
Hello,

I started working with the ObjectDataSourc e today. I have the select,
and have been working on getting the update method to work. Here is
the asp code for my Data source:

<asp:ObjectData Source ID="dsourceApps " runat="server"
SelectMethod="g etAllApplicatio ns"
TypeName="AppMg r.AppManager" UpdateMethod="u pdateAppHdr"
ConflictDetecti on="CompareAllV alues"
OldValuesParame terFormatString ="{0}_old"
OnObjectCreatin g="dsourceApps_ OnObjectCreatin g"
OnObjectDisposi ng="dsourceApps _OnObjectDispos ing">
<UpdateParamete rs>
<asp:Paramete r Name="appid" Type="String" />
<asp:Paramete r Name="appname" Type="String" />
<asp:Paramete r Name="apploc" Type="String" />
<asp:Paramete r Name="appdesc" Type="String" />
<asp:Paramete r Name="appid_old " Type="String" />
<asp:Paramete r Name="appname_o ld" Type="String" />
<asp:Paramete r Name="apploc_ol d" Type="String" />
<asp:Paramete r Name="appdesc_o ld" Type="String" />
</UpdateParameter s>
</asp:ObjectDataS ource>
The function sig for the updateAppHdr function is:

public void updateAppHdr(st ring appid, string appname, string apploc,
string appdesc, string appid_old, string appname_old, string
apploc_old, string appdesc_old)

The error that I get after I hit the save button after editing a field
in my GridView is:

Exception Details: System.Data.Ora cleClient.Oracl eException: ORA-06550:
line 1, column 7:
PLS-00306: wrong number or types of arguments in call to
'ND_UPD_DEFINED _APP'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I did some digging, and I'm noticing that all the new values (the
fields without "_old" appended) are coming into the function as NULL.
The old values are coming in properly, but the new values are just
null...

Any ideas why this is happening? It's actually getting into the
function, so I'm guessing it has something to do with the way the
gridview is setup... I can't seem to find anything on this on google,
or maybe I'm just not sure what to look for...

Thanks in advance for any help,
Mike

Jan 20 '06 #2
Thanks Phillip, I was away for a few days or I would have replied
sooner.

I did what you suggested, in the function to do the update, I went
ahead and hardcoded some values for the "new" fields (bypassing the
NULL's that were coming in) and the stored proc fired and executed just
fine.

The problem has to be with the null's getting passed in, but I can't
seem to track it down yet. Any more suggestions?

Thanks,
Mike

Jan 25 '06 #3
Welcome back Mike.

My first guess would be the 2-way databinding. The ObjectDataSourc e would
pass null for the parameter values if the databound server control was not
using 2-way databinding, e.g. if you had used itemtemplates in the GridView
with controls bound using the Eval method instead of the Bind, e.g.:
<asp:TextBox ID="txtapploc" runat="server" Text='<%# Eval("apploc"")
%>'></asp:TextBox>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Mike" wrote:
Thanks Phillip, I was away for a few days or I would have replied
sooner.

I did what you suggested, in the function to do the update, I went
ahead and hardcoded some values for the "new" fields (bypassing the
NULL's that were coming in) and the stored proc fired and executed just
fine.

The problem has to be with the null's getting passed in, but I can't
seem to track it down yet. Any more suggestions?

Thanks,
Mike

Jan 25 '06 #4
Hi again Phillip...

I did some googling, but I'm not understanding what you mean by this...
how do I implement 2 way databinding between the gridview and my
object? By using itemtemplates?

I'll keep looking, and thanks again for your help,
Mike
Phillip Williams wrote:
Welcome back Mike.

My first guess would be the 2-way databinding. The ObjectDataSourc e would
pass null for the parameter values if the databound server control was not
using 2-way databinding, e.g. if you had used itemtemplates in the GridView
with controls bound using the Eval method instead of the Bind, e.g.:
<asp:TextBox ID="txtapploc" runat="server" Text='<%# Eval("apploc"")
%>'></asp:TextBox>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Mike" wrote:
Thanks Phillip, I was away for a few days or I would have replied
sooner.

I did what you suggested, in the function to do the update, I went
ahead and hardcoded some values for the "new" fields (bypassing the
NULL's that were coming in) and the stored proc fired and executed just
fine.

The problem has to be with the null's getting passed in, but I can't
seem to track it down yet. Any more suggestions?

Thanks,
Mike


Jan 25 '06 #5
The 2-way databinding happens when the GridView automatic update is enabled:
“The automatic updating, deleting, and selection functionalities are enabled
when a button in a ButtonField or TemplateField column field, with a command
name of "Edit", "Delete", and "Select", respectively, is clicked. The
GridView control can automatically add a CommandField column field with an
Edit, Delete, or Select button if the AutoGenerateEdi tButton,
AutoGenerateDel eteButton, or AutoGenerateSel ectButton property is set to
true, respectively.‚Ä Ě
http://msdn2.microsoft.com/en-us/library/4w7ya1ts.aspx

In editing columns in a GridView one might use a BoundField or a customized
EditItemTemplat e combination. If you use the BoundField and want to enable
the 2-way databinding make sure that the ReadOnly property is not set to true
(the default value is false). If you used a customized EditItemTemplat e
(like I did in this demo
http://www.webswapp.com/CodeSamples/...idView_2c.aspx) then make sure
that you used Bind not Eval to set the values of the TextBoxes.

If this information does not help you solve the problem, you may want to
post the markup for the GridView so that I can take a second look on it for
you.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Mike" wrote:
Hi again Phillip...

I did some googling, but I'm not understanding what you mean by this...
how do I implement 2 way databinding between the gridview and my
object? By using itemtemplates?

I'll keep looking, and thanks again for your help,
Mike
Phillip Williams wrote:
Welcome back Mike.

My first guess would be the 2-way databinding. The ObjectDataSourc e would
pass null for the parameter values if the databound server control was not
using 2-way databinding, e.g. if you had used itemtemplates in the GridView
with controls bound using the Eval method instead of the Bind, e.g.:
<asp:TextBox ID="txtapploc" runat="server" Text='<%# Eval("apploc"")
%>'></asp:TextBox>

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Mike" wrote:
Thanks Phillip, I was away for a few days or I would have replied
sooner.

I did what you suggested, in the function to do the update, I went
ahead and hardcoded some values for the "new" fields (bypassing the
NULL's that were coming in) and the stored proc fired and executed just
fine.

The problem has to be with the null's getting passed in, but I can't
seem to track it down yet. Any more suggestions?

Thanks,
Mike


Jan 25 '06 #6
I checked out your source, and cannot see anything that you're really
doing different than me. I even changed an item to be a template
column and that did nothing for me as well...

Below is my markup for the gridview and datasource... Thanks again!

--------------------------------------------------
<asp:GridView ID="gvAppList" runat="server" AllowPaging="Tr ue"
AllowSorting="T rue"
Caption="Applic ation List" CssClass="table display"
DataSourceID="d sourceApps"
HorizontalAlign ="Center" PageSize="5" Width="95%"
CaptionAlign="T op" CellPadding="4" ForeColor="#333 333"
GridLines="None " AutoGenerateCol umns="False"
OnRowUpdating=" gvAppList_OnRow Updating"
AutoGenerateDel eteButton="True " AutoGenerateEdi tButton="True"
AutoGenerateSel ectButton="True ">
<Columns>
<asp:CommandFie ld ShowSelectButto n="True" />
<asp:BoundFie ld DataField="APPI D" HeaderText="App ID"
SortExpression= "appid" ApplyFormatInEd itMode="True" />
<asp:TemplateFi eld HeaderText="Nam e"
SortExpression= "APPNAME">
<EditItemTempla te>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("APPNAME") %>'></asp:TextBox>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("APPNAME") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="APPL OC" HeaderText="Loc ation"
SortExpression= "APPLOC" />
<asp:BoundFie ld DataField="APPD ESC"
HeaderText="Des cription" SortExpression= "APPDESC" />
</Columns>
<FooterStyle BackColor="#507 CD1" Font-Bold="True"
ForeColor="Whit e" />
<RowStyle BackColor="#EFF 3FB" />
<EditRowStyle BackColor="#246 1BF" />
<SelectedRowSty le BackColor="#D1D DF1" Font-Bold="True"
ForeColor="#333 333" />
<PagerStyle BackColor="#246 1BF" ForeColor="Whit e"
HorizontalAlign ="Center" />
<HeaderStyle BackColor="#507 CD1" Font-Bold="True"
ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>
<asp:ObjectData Source ID="dsourceApps " runat="server"
SelectMethod="g etAllApplicatio ns"
TypeName="AppMg r.AppManager" UpdateMethod="u pdateAppHdr"
ConflictDetecti on="CompareAllV alues"
OldValuesParame terFormatString ="{0}_old"
OnObjectCreatin g="dsourceApps_ OnObjectCreatin g"
OnObjectDisposi ng="dsourceApps _OnObjectDispos ing">
<UpdateParamete rs>
<asp:Paramete r Name="appid" Type="String" />
<asp:Paramete r Name="appname" Type="String" />
<asp:Paramete r Name="apploc" Type="String" />
<asp:Paramete r Name="appdesc" Type="String" />
<asp:Paramete r Name="appid_old " Type="String" />
<asp:Paramete r Name="appname_o ld" Type="String" />
<asp:Paramete r Name="apploc_ol d" Type="String" />
<asp:Paramete r Name="appdesc_o ld" Type="String" />
</UpdateParameter s>
</asp:ObjectDataS ource>
---------------------------------------

Jan 26 '06 #7
Hi Mike,

Using the code that you posted, I can only reproduce the situation that you
get if I turn the EnableViewState to false.

Here is your code working as expected:
http://www.webswapp.com/CodeSamples/...tate_true.aspx

Here is your code working as you described:
http://www.webswapp.com/CodeSamples/...ate_false.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Mike" wrote:
I checked out your source, and cannot see anything that you're really
doing different than me. I even changed an item to be a template
column and that did nothing for me as well...

Below is my markup for the gridview and datasource... Thanks again!

--------------------------------------------------
<asp:GridView ID="gvAppList" runat="server" AllowPaging="Tr ue"
AllowSorting="T rue"
Caption="Applic ation List" CssClass="table display"
DataSourceID="d sourceApps"
HorizontalAlign ="Center" PageSize="5" Width="95%"
CaptionAlign="T op" CellPadding="4" ForeColor="#333 333"
GridLines="None " AutoGenerateCol umns="False"
OnRowUpdating=" gvAppList_OnRow Updating"
AutoGenerateDel eteButton="True " AutoGenerateEdi tButton="True"
AutoGenerateSel ectButton="True ">
<Columns>
<asp:CommandFie ld ShowSelectButto n="True" />
<asp:BoundFie ld DataField="APPI D" HeaderText="App ID"
SortExpression= "appid" ApplyFormatInEd itMode="True" />
<asp:TemplateFi eld HeaderText="Nam e"
SortExpression= "APPNAME">
<EditItemTempla te>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("APPNAME") %>'></asp:TextBox>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("APPNAME") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="APPL OC" HeaderText="Loc ation"
SortExpression= "APPLOC" />
<asp:BoundFie ld DataField="APPD ESC"
HeaderText="Des cription" SortExpression= "APPDESC" />
</Columns>
<FooterStyle BackColor="#507 CD1" Font-Bold="True"
ForeColor="Whit e" />
<RowStyle BackColor="#EFF 3FB" />
<EditRowStyle BackColor="#246 1BF" />
<SelectedRowSty le BackColor="#D1D DF1" Font-Bold="True"
ForeColor="#333 333" />
<PagerStyle BackColor="#246 1BF" ForeColor="Whit e"
HorizontalAlign ="Center" />
<HeaderStyle BackColor="#507 CD1" Font-Bold="True"
ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>
<asp:ObjectData Source ID="dsourceApps " runat="server"
SelectMethod="g etAllApplicatio ns"
TypeName="AppMg r.AppManager" UpdateMethod="u pdateAppHdr"
ConflictDetecti on="CompareAllV alues"
OldValuesParame terFormatString ="{0}_old"
OnObjectCreatin g="dsourceApps_ OnObjectCreatin g"
OnObjectDisposi ng="dsourceApps _OnObjectDispos ing">
<UpdateParamete rs>
<asp:Paramete r Name="appid" Type="String" />
<asp:Paramete r Name="appname" Type="String" />
<asp:Paramete r Name="apploc" Type="String" />
<asp:Paramete r Name="appdesc" Type="String" />
<asp:Paramete r Name="appid_old " Type="String" />
<asp:Paramete r Name="appname_o ld" Type="String" />
<asp:Paramete r Name="apploc_ol d" Type="String" />
<asp:Paramete r Name="appdesc_o ld" Type="String" />
</UpdateParameter s>
</asp:ObjectDataS ource>
---------------------------------------

Jan 26 '06 #8
Phillip,

I went back and explicitely set the EnableViewState ="true" on the page,
masterpage, and gridview control, but still no go. I can see that it
works for you, but for some reason still no go here... I can see in the
page source when it's rendered in a browser that I am getting the
viewstate in the browser, I thought maybe it's getting "lost" somewhere
in the three page loads that happen, but I can't seem to view the
ViewState variable running in Debug mode (I'm not adding anything to it
through the code, so I probably just can't see what .NET adds to it
internally)...

I guess I'll try to do it without the Masterpage and see if I can't get
it to work...

I'll post back in a bit..

Jan 26 '06 #9
I took the code out of the masterpage and put it in it's own page,
hooked up the necessary events and fired it off and the values are
coming through fine, just like on your site.

So I guess now the question moves on to why is the masterpage messing
with my viewstate values on the return?

Thanks again for your help,
Mike

Jan 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
8714
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
5
1993
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
5
1935
by: Dabbler | last post by:
What is the best way to handle data interpolation between form controls and the actual sql data field. I have radio buttons that need to be interpreted, form values that have to be translated.. e.g. if (tbDaysDriveAlone.Text > 0) sb.Append( @"drive\"); if (tbDaysVanPool.Text > 0) sb.Append(@"vanPool\"); if (tbDaysCarpool > 0) sb.Append(@"Carpool\"); myObjectInstance.CommuteMethod = sb.ToString(); Should this be done in an event method...
3
3565
by: Jeronimo Bertran | last post by:
I have a FormView that shows details of a specific record on a table. The SelecMethod returns a DataSet that includes all the fields from my Event table and other read-only fields from linked tables. My FormView has controls that are bound to the fiuelds on the dataset table. I am now changing the FormView's Default Mode to Edit but I am having problems with the related fields. My ObjectDataSource is defined as: ...
2
3930
by: J055 | last post by:
Hi I have a method with the following signature: public bool UpdateSetAccounts(int items) { } How do I pass a collection of selected values in a ListBox to this ObjectDataSource UpdateMethod? I can pass the ListItemCollection in a ControlParameter, e.g.
1
1711
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several collections of textboxes prompting for entry into a fairly monolithic database. I decided to create a business object (called Employee) and use the ObjectDataSource to broker data being transmitted between the UI and my Employee object (and...
4
6090
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters are being populated. Integers are being passed as 0 and strings are empty regardless of what I changed them to in Edit mode on the GridView. My object method to perform the update:
9
8858
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find an answer. Even pacing around my flat until I nearly went into an altered state of reality proved futile. So here is the problem... When I link up the ObjectDataSource UpdateMethod to a method in the
0
4291
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't want to have my parameter names in those methods have to be "original_Parametername" or even if I change the OldValuesParameterFormatString to get rid of the "original" I would still have just "Parametername". I think most people user parameters...
0
9943
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9793
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10750
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9577
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectóplanning, coding, testing, and deploymentówithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5996
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3237
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.