PC Review


Reply
Thread Tools Rate Thread

Additional information: Object reference not set to an instance of

 
 
=?Utf-8?B?QnJhZA==?=
Guest
Posts: n/a
 
      17th Nov 2004
Receive the following error when stepping into the FILL (see last line).
Being a newbie I cannot see anything obvious.

Error message:
An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll
Additional information: Object reference not set to an instance of an object.


Code:
Function JobConsol()

MsgBox(selectedJobNo, MsgBoxStyle.DefaultButton2, "Starting the JOB
CONSOL function")

'Connection string
myConnectionString2 = "Database=c:\Program Files\Ezijobz
SME\Database\Demo\EJDB.FDB;User=SYSDBA;
Password=masterkey;Dialect=3;Server=localhost;Pooling=False"
myConnection2 = New FbConnection(myConnectionString2)
myConnection2.Open()

myTxn2 = myConnection2.BeginTransaction()

Dim ConsolCmd As String ' The SQL command for OPERATIONS
Dim dataAdapter2 As FbDataAdapter ' The FB Data Adapter
Dim DS2 As New DataSet ' The dataset
dataAdapter2 = New FbDataAdapter ' Set the data adapter

'Load dataset with OPERATIONS records where @JOBNO
ConsolCmd = "SELECT jobno, squences, opername, uniid FROM operations
WHERE jobno = @JOBNO ORDER BY jobno"
mycommand2 = New FbCommand(ConsolCmd, myConnection2, myTxn2) 'Set
the SQL
mycommand2.Parameters.Add("@JOBNO", FbDbType.Char)
mycommand2.Parameters("@JOBNO").Value = selectedJobNo
dataAdapter2.SelectCommand = mycommand2 'Set the Data Adapter
dataAdapter2.Fill(DS2, "Operations") 'Fill the Dataset with
OPERATIONS records

--
Brad
Sydney, Australia
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      17th Nov 2004
Brad,

Checking it, I did not see a simple error that can be the reason.

This error can be everywhere in your code, the earliest real execution is
the fill.
When you do this you will probably get more information.
Try
dataAdapter2.Fill(DS2, "Operations") 'Fill the Dataset with
Catch ex as exception
messagebox.show(ex.tostring)
End try

I do not know that firebird dataadatapter, maybe there are more errors to
catch.

And because this is a not standard adapter, command etc. I advice you to ask
this question when this will not give the solution as well in the newsgroup

microsoft.public.dotnet.framework.adonet

There you have more change for people used to non standard database
providers.

I hope this helps anyway something

Cor

"Brad" <(E-Mail Removed)>

> Receive the following error when stepping into the FILL (see last line).
> Being a newbie I cannot see anything obvious.
>
> Error message:
> An unhandled exception of type 'System.NullReferenceException' occurred in
> system.data.dll
> Additional information: Object reference not set to an instance of an
> object.
>
>
> Code:
> Function JobConsol()
>
> MsgBox(selectedJobNo, MsgBoxStyle.DefaultButton2, "Starting the JOB
> CONSOL function")
>
> 'Connection string
> myConnectionString2 = "Database=c:\Program Files\Ezijobz
> SME\Database\Demo\EJDB.FDB;User=SYSDBA;
> Password=masterkey;Dialect=3;Server=localhost;Pooling=False"
> myConnection2 = New FbConnection(myConnectionString2)
> myConnection2.Open()
>
> myTxn2 = myConnection2.BeginTransaction()
>
> Dim ConsolCmd As String ' The SQL command for
> OPERATIONS
> Dim dataAdapter2 As FbDataAdapter ' The FB Data Adapter
> Dim DS2 As New DataSet ' The dataset
> dataAdapter2 = New FbDataAdapter ' Set the data adapter
>
> 'Load dataset with OPERATIONS records where @JOBNO
> ConsolCmd = "SELECT jobno, squences, opername, uniid FROM
> operations
> WHERE jobno = @JOBNO ORDER BY jobno"
> mycommand2 = New FbCommand(ConsolCmd, myConnection2, myTxn2) 'Set
> the SQL
> mycommand2.Parameters.Add("@JOBNO", FbDbType.Char)
> mycommand2.Parameters("@JOBNO").Value = selectedJobNo
> dataAdapter2.SelectCommand = mycommand2 'Set the Data Adapter
> dataAdapter2.Fill(DS2, "Operations") 'Fill the Dataset with
> OPERATIONS records
>
> --
> Brad
> Sydney, Australia



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th Nov 2004
"Brad" <(E-Mail Removed)> schrieb:
> Receive the following error when stepping into the FILL (see last line).



If you don't get an answer here, give the folks in
microsoft.public.dotnet.framework.adonet or a similar group that is related
to database questions a try.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
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
Additional information: Object reference not set to an instance ofan object................. Supra Microsoft VB .NET 1 3rd Jan 2005 06:55 AM
Additional information: Object reference not set to an instance ofan object................ Supra Microsoft VB .NET 4 28th Dec 2004 02:56 PM
Additional information: Object reference not set to an instance of =?Utf-8?B?QnJhZA==?= Microsoft ADO .NET 2 17th Nov 2004 10:54 PM
Additional information: Object reference not set to an instance of an object. michael walser Microsoft C# .NET 4 12th Apr 2004 11:58 AM
Win32_Printer: System.NullReferenceException - Additional information: Object reference not set to an instance of an object. J M Microsoft C# .NET 2 7th Oct 2003 06:16 PM


Features
 

Advertising
 

Newsgroups
 


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