473,491 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

dataadapter - object reference not set...

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

Mar 28 '06 #1
1 2104
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.

"dast" <da**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
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

Mar 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4194
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
3
2815
by: Steve Bishop | last post by:
I'm using a DataSet object and binding it to a data grid. I would like to filter the records I display by using a text box. I'm trying not to take a literal string value but a wild card. I would...
1
4205
by: Harry V | last post by:
I'm wondering if there is a limit of a single select, delete and insert statement (command) to each dataadapter? On a form, I have a dataconnection that is shared by 3 dataadapters, one for each of...
5
4534
by: JJ | last post by:
Hi, I created a DataAdapter, connection object and dataset generated from DataAdapter by dragging DataAdapter compenent to win form. Now in the code behind I want to use that DataAdapter. I go...
0
1066
by: Lucas Tam | last post by:
Is there a way to call DataAdapter.Update from a Dataview when I have no reference to the DataAdapter? i.e. The DataView is a class variable however the dataadapter is a local variable in a sub...
8
2671
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
2
1870
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e....
0
2093
by: webbsk | last post by:
I keep getting an exception when I call the DataAdapter Update method. I have been trying to figure out what is causing the null reference exception for this code for what seems like forever: ...
0
4526
by: mike1402 | last post by:
Hi ! I get the error below sometimes when retrieving a big amount of data using Datadapter.Fill(dataset,"table"). But when I send the command Fill again, there is no error. Is it a fault of...
0
7112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.