Additional information: Object reference not set to an instance of

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Jeff,
Hi. Thanks for the response.

Two lines down from the DIM for the data adapter is the line...

dataAdapter2 = New FbDataAdapter

Does this do the same thing that you recommend?
Brad


Jeff Dillon said:
Should it be as New FbDataAdapter?

Jeff
 
Back
Top