Error in System.Data (problem loading simple dataset)

Hi

I am new to VB.NET

I am working through a sample in a book I bought (Visual Basic.NET Black Book) and the very first ADO sample is messing me up.

I am using the SQL objects from the toolbox, and the SQL server connection items (sorry-- Im not so good on .Net lingo yet)

I have a connection to SQL/Pubs (My login, permissions etc on this DB work)

Heres what I did:
* I dragged the authors table from my connection (which I made under the data connections view in the server explorer) and that gave me SqlConnection1 and DataAdapter1 in the component tray.

* right clicked on the data adapater and selected "generate dataset"
* from the data set window, I chose the "new" option and called it "dataset3", checked the authors table and chose 'add to designer'
This gave me a data set called DataSet31

* I added a data grid to the form, and set the data source property to DataSet31 and the data member property to 'authors'

* I then went into the form code load event and added this code:

DataSet31.Clear()
SqlDataAdapter1.Fill(DataSet31)

When I run it, I get an error on the line that I call the FILL method that says this: "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll"

I cant figure this out. I followed the tutorial instructions to the letter...

IN asp.net, I did the same thing, and it worked fine...

ps-- I previewed the dataset using the IDE and that worked too.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories