Newbie question with DataSet

Hello,

I am trying to put data into a dataset using cf 2.0. Below is the code. There is valid data in the database that should be returned but I keep getting the null error. Any help would be appreciated.

Error: on the catch exception of the try.....Value can not be null.Parameter name: dataSet

Code:

Private Sub GetCompanyNames()

Dim conn As SqlCeConnection = New SqlCeConnection(strConn)

Dim strSQLStatment As String = "SELECT id, name FROM companies"

Dim dsCompanyNames As DataSet = Nothing

Dim command As New SqlCeCommand(strSQLStatment, conn)

Try

Dim daCompanyNames As New SqlCeDataAdapter(command)

daCompanyNames.Fill(dsCompanyNames)

Catch ex As Exception

MessageBox.Show(Err.ToString)

Finally

End Try

End Sub



Answer this question

Newbie question with DataSet

  • trej

    Hi!

    You declare dsCompanyNames but do not create this object (=Nothing). You must create object to fill it's content by adapter.



  • Newbie question with DataSet