Connecting Tech Pros Worldwide Forums | Help | Site Map

Updating Oracle Datasets

Parveen
Guest
 
Posts: n/a
#1: Nov 20 '05
I am having trouble setting the update command of my oracle adapter to the name of an Oracle
stored procedure. My data adapter is a global variable that I use in multiple functions.
But the following line of code

g_Da.UpdateCommand.CommandType = CommandType.StoredProcedur

Generates this error
System.NullReferenceException: Object reference not set to an instance of an object

Does anyone know why? Can someone tell me how I can successful set the update command of my
data adapter to my stored procedure

Thanks for your help

Parveen

Armin Zingler
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Updating Oracle Datasets


"Parveen" <anonymous@discussions.microsoft.com> schrieb[color=blue]
> I am having trouble setting the update command of my oracle adapter
> to the name of an Oracle stored procedure. My data adapter is a
> global variable that I use in multiple functions. But the following
> line of code:
>
> g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
>
> Generates this error:
> System.NullReferenceException: Object reference not set to an
> instance of an object.
>
> Does anyone know why? Can someone tell me how I can successful set
> the update command of my data adapter to my stored procedure?[/color]

Either you didn't create a DataAdapter, or you didn't create an
UpdateCommand.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Updating Oracle Datasets


* "=?Utf-8?B?UGFydmVlbg==?=" <anonymous@discussions.microsoft.com> scripsit:[color=blue]
> I am having trouble setting the update command of my oracle adapter to the name of an Oracle
> stored procedure. My data adapter is a global variable that I use in multiple functions.
> But the following line of code:
>
> g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
>
> Generates this error:
> System.NullReferenceException: Object reference not set to an instance of an object.[/color]

Are you sure you assigned something to the 'UpdateCommand' property?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Armin Zingler
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Updating Oracle Datasets


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb[color=blue][color=green]
> > g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
> >
> > Generates this error:
> > System.NullReferenceException: Object reference not set to an
> > instance of an object.[/color]
>
> Are you sure you assigned something to the 'UpdateCommand'
> property?[/color]


"yes, but it does not work:"

g_da.UpdateCommand = Something



--
Armin

Cor
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Updating Oracle Datasets


Parveen, dont take attention to it, this is just about the word "something"

Hi Armin,
[color=blue][color=green]
> > Are you sure you assigned something to the 'UpdateCommand'
> > property?[/color]
>
> g_da.UpdateCommand = Something[/color]

I think this would be a very big error.

I would like it if there was in VB a statement as
If x Is Something (with an uppercase)

And therefore the message from Herfried with a lowercase is in my eyes very
correct.

:-))

Cor


Armin Zingler
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Updating Oracle Datasets


"Cor" <non@non.com> schrieb[color=blue]
> Parveen, dont take attention to it, this is just about the word
> "something"[/color]

Thx. :)

[color=blue][color=green][color=darkred]
> > > Are you sure you assigned something to the 'UpdateCommand'
> > > property?[/color]
> >
> > g_da.UpdateCommand = Something[/color]
>
> I think this would be a very big error.
>
> I would like it if there was in VB a statement as
> If x Is Something (with an uppercase)
>
> And therefore the message from Herfried with a lowercase is in my
> eyes very correct.
>
> :-))[/color]


:)

Won't there be the IsNot operator in the next version?

if x IsNot Nothing then


--
Armin

Cor
Guest
 
Posts: n/a
#7: Nov 20 '05

re: Updating Oracle Datasets


Hi Armin,[color=blue]
>
> if x IsNot Nothing then[/color]

I am one of the few, but I hope not because this is also then possible

if Not x IsNot Nothing then

brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

I keep going in this newsgroup for

if x Is Something

Cor


Armin Zingler
Guest
 
Posts: n/a
#8: Nov 20 '05

re: Updating Oracle Datasets


"Cor" <non@non.com> schrieb[color=blue]
> Hi Armin,[color=green]
> >
> > if x IsNot Nothing then[/color]
>
> I am one of the few, but I hope not because this is also then
> possible
>
> if Not x IsNot Nothing then
>
> brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
>
> I keep going in this newsgroup for
>
> if x Is Something[/color]

But then this is also possible:

If not not x is something then

brrrrrrrr

;-)


--
Armin

Cor
Guest
 
Posts: n/a
#9: Nov 20 '05

re: Updating Oracle Datasets


Hi Parveen,

Probably you have only to add this line
g_Da = New OracledataAdapter
before line[color=blue]
> g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
>[/color]
Or more probably put the new direct in your clobal g_Da something as
private g_DA as New OracledataAdapter

I hope this helps?

Cor


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#10: Nov 20 '05

re: Updating Oracle Datasets


* "Armin Zingler" <az.nospam@freenet.de> scripsit:[color=blue][color=green]
>> I keep going in this newsgroup for
>>
>> if x Is Something[/color]
>
> But then this is also possible:
>
> If not not x is something then[/color]

Why not both, 'Something' and 'IsNot':

\\\
If x IsNot Something Then...
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#11: Nov 20 '05

re: Updating Oracle Datasets


* "Armin Zingler" <az.nospam@freenet.de> scripsit:[color=blue]
> Won't there be the IsNot operator in the next version?
>
> if x IsNot Nothing then[/color]

Yes.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Cor
Guest
 
Posts: n/a
#12: Nov 20 '05

re: Updating Oracle Datasets


Hi Herfried,

I think because IsNot is again a new keyword.
And if you can avoid them you should do that.

(I know the answer Something is also new, but "something" is a natural word
and IsNot, if you have read something before from me, you know the rest of
my explanation)

Cor[color=blue]
>
> Why not both, 'Something' and 'IsNot':[/color]


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#13: Nov 20 '05

re: Updating Oracle Datasets


* "Cor" <non@non.com> scripsit:[color=blue]
> I think because IsNot is again a new keyword.
> And if you can avoid them you should do that.[/color]

Mhm... I like new keywords if they make sense.
[color=blue]
> (I know the answer Something is also new, but "something" is a natural word
> and IsNot, if you have read something before from me, you know the rest of
> my explanation)[/color]

Yep -- I would prefer 'Something' too.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Parveen
Guest
 
Posts: n/a
#14: Nov 20 '05

re: Updating Oracle Datasets


Ok...so what do you guys mean when you ask me if I set my UpdateCommand to something?

Wasn't I doing that when I did....

g_Da.UpdateCommand.CommandText = "PCD_HRLY_CODE_ENF_Update"
g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure

The project's blowing up on the first line...do u guys know how i can fix this or can you explain
what you meant by your advice earlier?

Hope I won't cause another controversy!! ;)

Parveen
Cor
Guest
 
Posts: n/a
#15: Nov 20 '05

re: Updating Oracle Datasets


Hi Parveen,

This was an Off Thread discussion not about the message itself, but about
the answer.
At the start of this OT I did wrote that this was not about your problem.

I did gave an answer before I did that so have a look at that.

But in this newsgroups is Oracle never a topic.

If my answer does not fit you can try it in the newsgroup

Microsoft.public.dotnet.framework.adonet

There is Miha active, with him you have the best change for Oracle problems
I think.

Cor
[color=blue]
> g_Da.UpdateCommand.CommandText = "PCD_HRLY_CODE_ENF_Update"
> g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
>
> The project's blowing up on the first line...do u guys know how i can fix[/color]
this or can you explain[color=blue]
> what you meant by your advice earlier?[/color]


Parveen
Guest
 
Posts: n/a
#16: Nov 20 '05

re: Updating Oracle Datasets


I get past that error message if I add the following line of code before doing anything with the update statement:

myDa.UpdateCommand = New OracleCommand

Thanks for your advice....it led me in the right direction!!
Parveen
Guest
 
Posts: n/a
#17: Nov 20 '05

re: Updating Oracle Datasets


Yes I know that it was an off thread discussion...and you did mention that...which is totally fine with me
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#18: Nov 20 '05

re: Updating Oracle Datasets


* "=?Utf-8?B?UGFydmVlbg==?=" <anonymous@discussions.microsoft.com> scripsit:[color=blue]
> Ok...so what do you guys mean when you ask me if I set my UpdateCommand to something?
>
> Wasn't I doing that when I did....
>
> g_Da.UpdateCommand.CommandText = "PCD_HRLY_CODE_ENF_Update"
> g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure[/color]

What result to you get if you run this code before the 1st line?

\\\
MsgBox((g_Da Is Nothing).ToString())
MsgBox((g_Da.UpdateCommand Is Nothing).ToString())
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Parveen
Guest
 
Posts: n/a
#19: Nov 20 '05

re: Updating Oracle Datasets


Herfreid,
It works when I insert the following line of code before doing anything with the UpdateCommand:

myDa.UpdateCommand = New OracleCommand

Thanks for your help! :)

Parveen

Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#20: Nov 20 '05

re: Updating Oracle Datasets


* "=?Utf-8?B?UGFydmVlbg==?=" <anonymous@discussions.microsoft.com> scripsit:[color=blue]
> It works when I insert the following line of code before doing anything with the UpdateCommand:
>
> myDa.UpdateCommand = New OracleCommand[/color]

That's what I expected.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Closed Thread