• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

value can not be null in datatable in vb.net 2005

Hi,

I have the following code: -

SQL = "Select * from dbo.Locations"
        dbOpen()
        Dim da As New SqlClient.SqlDataAdapter(SQL, oConn)

        da.Fill(ds, "Locations")
        DataGridView1.DataSource = ds.Tables("Locations")

It always comes up with: -

Value cannot be null.
Parameter name: dataSet

What does this mean please and how to I resolve it.

Many Thanks
Lee
0
ljhodgett
Asked:
ljhodgett
1 Solution
 
DhaestCommented:
The error message means that the dataset object you are passing is not instantiated.
How are you instantiating the dataset object?
Dim ds as Dataset.
or
Dim ds as new dataset?
I think if you make an instance of the dataset object, this problem should go away.


SQL = "Select * from dbo.Locations"
        dbOpen()
        Dim da As New SqlClient.SqlDataAdapter(SQL, oConn)
        Dim ds as New DataSet
        da.Fill(ds, "Locations")
        DataGridView1.DataSource = ds.Tables("Locations")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now