473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can't get a simple dataset working

I know I will feel stupid when someone points it out but what is wrong
with this:

Dim Connection1 As SqlClient.SqlConnection = New
SqlClient.SqlConnection("Database=MyStore;uid=sa;p wd=password")

Connection1.Open()
Dim StringSelect = "select * from amazon"
Dim cmd2 As SqlClient.SqlCommand = _
New SqlClient.SqlCommand("SELECT * FROM amazon", Connection1)
Dim DA1 As SqlClient.SqlDataAdapter
Dim DS1 As DataSet
DA1.SelectCommand = cmd2

The last line throws me a "Object reference not set to an instance of
an object"

Please tell me what I am missing?

Thanks
Russ
Nov 20 '05 #1
2 2599
Dim DA1 As New SqlClient.SqlDataAdapter()
---

Sillybilly :)
"OrlandoRocks" <pa********@orlandorocks.com> wrote in message
news:55**************************@posting.google.c om...
I know I will feel stupid when someone points it out but what is wrong
with this:

Dim Connection1 As SqlClient.SqlConnection = New
SqlClient.SqlConnection("Database=MyStore;uid=sa;p wd=password")

Connection1.Open()
Dim StringSelect = "select * from amazon"
Dim cmd2 As SqlClient.SqlCommand = _
New SqlClient.SqlCommand("SELECT * FROM amazon", Connection1)
Dim DA1 As SqlClient.SqlDataAdapter
Dim DS1 As DataSet
DA1.SelectCommand = cmd2

The last line throws me a "Object reference not set to an instance of
an object"

Please tell me what I am missing?

Thanks
Russ

Nov 20 '05 #2
"OrlandoRocks" <pa********@orlandorocks.com> schrieb:
Dim DA1 As SqlClient.SqlDataAdapter
Replace the line above with:

\\\
Dim DA1 As New SqlClient.SqlDataAdapter()
///
Dim DS1 As DataSet
DA1.SelectCommand = cmd2

The last line throws me a "Object reference not set to an instance of
an object"


--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
5
by: Lasse Edsvik | last post by:
Hello Im trying to create a simple testclass that connects to a db on localhost and a method that returns a dataset. I get these errors: Unhandled Exception: System.InvalidOperationException:...
7
by: Matt Jensen | last post by:
Howdy Fairly simple question I think, I presume the answer is no it can't be reused for 2 *SELECT* statements, but just hoping for clarification. Just asking in the interests of trying to minimise...
9
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later...
9
by: Steven C. | last post by:
Hello: I'm getting an error, "primary key not defined" when trying to use the FIND method on the DataTable Rows collection. I have a typed dataset called 'MortgagesDS' that I created with the...
3
by: Bryan | last post by:
I have an MS Access DB with a table' Isometric' . One of the columns is named 'Sheet'. I am doin a test to see if I can change a value in the dataset and update the Access table with the...
2
by: Sheikko | last post by:
ADO.NET - Working with DataSet ========================= HI, I want to create an application that interact with a DB. I wont to use SQL statement, but I want to use DataSet. - I have created my...
5
by: cj2 | last post by:
This code works: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using...
0
by: JB | last post by:
Code is taken straight from a book but i can't get it working right. Its generating an insert statement for inserting data into an excel file. //foreach (DataTable dt in ds.Tables) //private...
1
by: csgirlie | last post by:
I'm trying to store or arrange three sets of two-dimensional data into three 2xN matrices that are stored as NumPy arrays. import os # for file handling functions import numpy as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.