dataadapter - object reference not set...

G

Guest

Hello,

I get an error saying "object reference not set to an instance of an object"
when running my application on some computers (not all!).

The error is on the last line (da3.fill) in this code:


Dim ds As New DataSet

Private Sub Save_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'...

cn.ConnectionString = myConn '...
Dim da As New SqlDataAdapter("USE Smart2DB SELECT DISTINCT
MeasurementSeries FROM Measurements", cn.ConnectionString)

da.Fill(ds, "Measurements")

'...

ds.Clear()
ds.Tables.Clear()

Dim da2 As New SqlDataAdapter("SELECT MeasurementSeries, SeriesNo FROM
Measurements", cn.ConnectionString)
da2.Fill(ds, "Measurements")

'...

Dim da3 As New SqlDataAdapter(mySelectCommand, myConnectionString)
ds.Clear()
ds.Tables.Clear()
da3.Fill(ds, "Measurements")

'...

End Sub




Any ideas why this only happens on some computers and not all?
And why not on the first dataadapter.fill(dataset) line?

I'm stuck. Googling hasn't helped me...
I would really appreciate help with this.
Please tell me if you need more information/code.

TIA and best regards
/DAST
 
K

Kevin Spencer

My first guess would be that it has something to do with "mySelectCommand,"
which you didn't include in your post.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 

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