Object reference not set to an instance of an object.

M

Martina

The code below is what I am getting this error message from, can anyone see
why?

<WebMethod()> Public Function PickOnePatientFiles(ByVal name As String) As
DataSet

Dim selstring As String

Dim empid As Int32 = 0

Dim OutputList As New DataSet()

selstring = "SELECT CentralPatientID, Name, MedicareNumber, OtherID FROM
CentralPatientIndex WHERE Name = """ + name + """"

OleDbSelectCommand1.CommandText = selstring

OleDbDataAdapter1.Fill(OutputList, "PatientIndex")

empid =
CType(OutputList.Tables("CentralPatientIndex").Rows(0).Item("OtherID"),
Int32)

selstring = "SELECT * FROM Imaging Request WHERE OtherID = " + CStr(empid)

OleDbSelectCommand1.CommandText = selstring

OleDbDataAdapter1.Fill(OutputList, "Maitland_XRay")

PickOnePatientFiles = OutputList

End Function
 
C

Cor Ligthert

Martina,

Please stay in the original thread all your messages go about the same
problem.
I sand you an answer with a sample however you ignored it without even to
mention why.

Cor

"Martina"> The code below is what I am getting this error message from, can
anyone see
 
M

Martina

This message is about a different database.

I am no longer using Employees, now I am using patients etc.

Sorry, but what you have written did help before but I have now changed this
code for Patients etc.
 
C

Cor Ligthert

Martina said:
This message is about a different database.

I am no longer using Employees, now I am using patients etc.

Sorry, but what you have written did help before but I have now changed
this code for Patients etc.

You can use the same methods from Eployees for Patients, as data there is
not much difference.

Cor
 
M

Martina

Ok thanks, i will try this.

How about my problem where the same field is called OtherID in one table and
PatientID in the other table. Do I have to have a line that says one equals
the other?
 

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