PC Review


Reply
Thread Tools Rate Thread

Development envionment vs runtime??

 
 
Stu
Guest
Posts: n/a
 
      17th Jul 2004
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


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      17th Jul 2004
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


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th Jul 2004
* "Stu" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Stu
Guest
Posts: n/a
 
      17th Jul 2004
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(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& 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(Message& 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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:eERSxO$(E-Mail Removed)...
> * "Stu" <(E-Mail Removed)> 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/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th Jul 2004
* "Stu" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Stu
Guest
Posts: n/a
 
      17th Jul 2004
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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> * "Stu" <(E-Mail Removed)> 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/>



 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      18th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Venkat Subramaniam to Speak on Debugging Ajax, Agile Development,Test Driven Development in .NET, Programming Groovy Shaguf Microsoft C# .NET 0 28th Nov 2008 07:27 AM
Venkat Subramaniam to Speak on Debugging Ajax, Agile Development,Test Driven Development in .NET, Programming Groovy Shaguf Microsoft Dot NET Framework 0 28th Nov 2008 07:18 AM
Venkat Subramaniam to Speak on Debugging Ajax, Agile Development,Test Driven Development in .NET, Programming Groovy Shaguf Microsoft C# .NET 0 27th Nov 2008 06:04 AM
Management of Servers in small envionment Andrew Microsoft Windows 2000 Deployment 6 26th Sep 2003 08:01 PM
simultaneous access: registry vs envionment variables [RaZoR] Microsoft Windows 2000 0 29th Aug 2003 09:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.