By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Development envionment vs runtime??

P: n/a
Stu
with the following code snippet

Dim ConOra As OracleConnection = New OracleConnection()
ConOra.ConnectionString = "User Id=USER;Password=PASSWORD;Data
Source=orcl9i;"
Dim Sql As String = "select * from CCO_MOTD order by ID "
Dim cmd As OracleCommand = New OracleCommand(Sql)
cmd.Connection = ConOra
cmd.CommandType = CommandType.Text
' Execute command, create OracleDataReader object
Dim reader As OracleDataReader = cmd.ExecuteReader()
While (reader.Read())
Message(reader.GetDecimal(12)) = reader.GetString(0)
MaxMessage = reader.GetDecimal(12)
Console.WriteLine("MSG: " + Message(MaxMessage))
End While
cmd.Dispose()

Everyone runs happy and fine in the development envionment. When I create
the install files, or run the .exe, it throws a 'Object reference not set to
an instance of an object' error at the While(reader.Read()). This happens
on other systems as well as my own.

An interesting note, when running the exe file on a coworkers machine, who's
setup is the same as mine (same version of .NET runtime, same version of
VS.NET and same version of Oracle) - things run just fine when running the
..exe file.

Where do I go from here, is this a known issue, help ?

Thanks much in advance...

Stu
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Stu,

For Oracle related questions (where it can not be in the laguage because it
works on only a few machines not) is in my opininion this the best place in
the dotnet newsgroups.

Adonet
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<http://communities2.microsoft.com/co...s/?dg=microsof
t.public.dotnet.framework.adonet>

In that newsgroup will probably help Miha, one of the Bills or others you
with your question.

When you are in doubt what is the best newsgroup, crosspost it (not
multipost), crossposting is sending to more dotnet newsgroups in one time.

I hope this helps?

Cor
Nov 20 '05 #2

P: n/a
* "Stu" <St*@thynk.us> scripsit:
Dim reader As OracleDataReader = cmd.ExecuteReader()
Did you check if 'reader' is 'Nothing' there? What's the complete
exception text?
While (reader.Read())
Message(reader.GetDecimal(12)) = reader.GetString(0)
MaxMessage = reader.GetDecimal(12)
Console.WriteLine("MSG: " + Message(MaxMessage))
End While
cmd.Dispose()

Everyone runs happy and fine in the development envionment. When I create
the install files, or run the .exe, it throws a 'Object reference not set to
an instance of an object' error at the While(reader.Read()). This happens
on other systems as well as my own.


--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a
Stu
I put the following lines in to check if the reader is nothing...
if reader is Nothing then
msgbox ("reader is nothing")
else
msgbox ("reader is something")
end if

Returns that "reader is something" in both the IDE and the runtime, is the
code above the correct way to check? The complete exception text follows:

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an
object.
at MOTD.Module1.ReadFromOra() in C:\Documents and Settings\wellss\My
Documents\Visual Studio Projects\WindowsApplication2\Module1.vb:line 33
at MOTD.FrmMOTD.FrmMOTD_Load(Object sender, EventArgs e) in C:\Documents
and Settings\wellss\My Documents\Visual Studio
Projects\WindowsApplication2\FORMMOTD.vb:line 143
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

At this point I'm wondering if I'm using a different version of the ODP.NET
in the IDE than I am in the RunTime, is this possible and would this be
casuing the difference in the errors?

Thanks again!

Stu

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eE*************@TK2MSFTNGP09.phx.gbl...
* "Stu" <St*@thynk.us> scripsit:
Dim reader As OracleDataReader = cmd.ExecuteReader()


Did you check if 'reader' is 'Nothing' there? What's the complete
exception text?
While (reader.Read())
Message(reader.GetDecimal(12)) = reader.GetString(0)
MaxMessage = reader.GetDecimal(12)
Console.WriteLine("MSG: " + Message(MaxMessage))
End While
cmd.Dispose()

Everyone runs happy and fine in the development envionment. When I create the install files, or run the .exe, it throws a 'Object reference not set to an instance of an object' error at the While(reader.Read()). This happens on other systems as well as my own.


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

Nov 20 '05 #4

P: n/a
* "Stu" <St*@thynk.us> scripsit:
I put the following lines in to check if the reader is nothing...
if reader is Nothing then
msgbox ("reader is nothing")
else
msgbox ("reader is something")
end if

Returns that "reader is something" in both the IDE and the runtime, is the
code above the correct way to check? The complete exception text follows:
Yes, that's correct and it tells us that this is not the reason for the
exception.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an
object.
at MOTD.Module1.ReadFromOra() in C:\Documents and Settings\wellss\My


Did you post the code of 'ReadFromOra'?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

P: n/a
Stu
Yes, the code that was posted was from 'ReadFromOra', and using the JIT
debugger, I confimed that the exception is being thrown on

While(reader.read())

reinstalling the Oracle 9i Client and the Oracle Data Provider packages made
no difference.

Where next?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OX*************@tk2msftngp13.phx.gbl...
* "Stu" <St*@thynk.us> scripsit:
I put the following lines in to check if the reader is nothing...
if reader is Nothing then
msgbox ("reader is nothing")
else
msgbox ("reader is something")
end if

Returns that "reader is something" in both the IDE and the runtime, is the code above the correct way to check? The complete exception text follows:

Yes, that's correct and it tells us that this is not the reason for the
exception.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance

of an object.
at MOTD.Module1.ReadFromOra() in C:\Documents and Settings\wellss\My


Did you post the code of 'ReadFromOra'?

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

Nov 20 '05 #6

P: n/a
Stu,

I don't know Oracle, but where do you open your connection? Where are you
closing your datareader? Probably not relevant since you say it runs in IDE
anyways.

Greg

Dim ConOra As New OracleConnection("User
Id=USER;Password=PASSWORD;Data Source=orcl9i;")
Dim Sql As String = "select * from CCO_MOTD order by ID "
Dim cmd As New OracleCommand(Sql, ConOra)

Dim reader As OracleDataReader
Try
ConOra.Open()
' Execute command, create OracleDataReader object
reader = cmd.ExecuteReader()
While (reader.Read())
Message(reader.GetDecimal(12)) = reader.GetString(0)
MaxMessage = reader.GetDecimal(12)
Console.WriteLine("MSG: " + Message(MaxMessage))
End While

Catch ex As Exception
MsgBox(ex.ToString)

Finally
If Not reader Is Nothing AndAlso Not reader.IsClosed Then
reader.Close()

If Not ConOra Is Nothing AndAlso Not ConOra.State =
ConnectionState.Closed Then ConOra.Close()

cmd.Dispose()
End Try
"Stu" <St*@thynk.us> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
with the following code snippet

Dim ConOra As OracleConnection = New OracleConnection()
ConOra.ConnectionString = "User Id=USER;Password=PASSWORD;Data
Source=orcl9i;"
Dim Sql As String = "select * from CCO_MOTD order by ID "
Dim cmd As OracleCommand = New OracleCommand(Sql)
cmd.Connection = ConOra
cmd.CommandType = CommandType.Text
' Execute command, create OracleDataReader object
Dim reader As OracleDataReader = cmd.ExecuteReader()
While (reader.Read())
Message(reader.GetDecimal(12)) = reader.GetString(0)
MaxMessage = reader.GetDecimal(12)
Console.WriteLine("MSG: " + Message(MaxMessage))
End While
cmd.Dispose()

Everyone runs happy and fine in the development envionment. When I create
the install files, or run the .exe, it throws a 'Object reference not set
to
an instance of an object' error at the While(reader.Read()). This happens
on other systems as well as my own.

An interesting note, when running the exe file on a coworkers machine,
who's
setup is the same as mine (same version of .NET runtime, same version of
VS.NET and same version of Oracle) - things run just fine when running
the
.exe file.

Where do I go from here, is this a known issue, help ?

Thanks much in advance...

Stu

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.