|
-
Mar 22nd, 2004, 11:09 AM
#1
Thread Starter
New Member
Combobox and dataset
I am trying to populate a combobox from a dataset but I am getting the following error: System.NullReferenceException, object reference not set to an instance of an object.
here's my code, can't see where I failed to instantiate.
Dim dad = New OleDbDataAdapter
Dim ds As DataSet
Dim strConn, strSQL As String
strConn = "Data Source=Data3;Integrated Security=SSPI"
strSQL = "Select instNbr from MyTable"
dad = New SqlClient.SqlDataAdapter(strSQL, strConn)
ds = New DataSet
dad.Fill(ds)
cboInstNbr.DataSource = ds.Tables("MyTable")
cboInstNbr.DisplayMember = ds.Tables("MyTable").Columns("instNbr").ToString
the error occurs on the displaymember line of code.
Help a newbie with VB.Net.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|