Updating Oracle Datasets

G

Guest

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
 
A

Armin Zingler

Parveen said:
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?

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

Herfried K. Wagner [MVP]

* "=?Utf-8?B?UGFydmVlbg==?= said:
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.

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

Armin Zingler

Herfried K. Wagner said:
Are you sure you assigned something to the 'UpdateCommand'
property?


"yes, but it does not work:"

g_da.UpdateCommand = Something
 
C

Cor

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

Hi Armin,
g_da.UpdateCommand = Something

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
 
A

Armin Zingler

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

Thx. :)

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.

:))


:)

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

if x IsNot Nothing then
 
C

Cor

Hi Armin,
if x IsNot Nothing then

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
 
A

Armin Zingler

Cor said:
Hi Armin,

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

But then this is also possible:

If not not x is something then

brrrrrrrr

;-)
 
C

Cor

Hi Parveen,

Probably you have only to add this line
g_Da = New OracledataAdapter
before line
g_Da.UpdateCommand.CommandType = CommandType.StoredProcedure
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
 
H

Herfried K. Wagner [MVP]

* "Armin Zingler said:
But then this is also possible:

If not not x is something then

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

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

Cor

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
 
H

Herfried K. Wagner [MVP]

* "Cor said:
I think because IsNot is again a new keyword.
And if you can avoid them you should do that.

Mhm... I like new keywords if they make sense.
(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)

Yep -- I would prefer 'Something' too.
 
G

Guest

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
 
C

Cor

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
 
G

Guest

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!!
 
G

Guest

Yes I know that it was an off thread discussion...and you did mention that...which is totally fine with me
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?UGFydmVlbg==?= said:
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

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())
///
 
G

Guest

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
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?UGFydmVlbg==?= said:
It works when I insert the following line of code before doing anything with the UpdateCommand:

myDa.UpdateCommand = New OracleCommand

That's what I expected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top