By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,554 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,554 IT Pros & Developers. It's quick & easy.

Binding a combo box

P: n/a
TS
I configured a data adapter and generated a dataset and wrote the code to
fill the dataset with data coming from an SQL database table when my form
loads. I also changed the DataSource of a combo box to point to the
dataset.tablename and changed the DisplayMemebr to point at a column. After
the form loads nothing is populated in the combo box? Is there something I'm
missing. Please help
--
TS
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Here is an example.

Dim strConn As String

Dim strSQL As String

Dim ds As New DataSet

Dim da As OleDbDataAdapter

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * From Categories", conn)

da.Fill(ds, "Categories")

ComboBox1.DataSource = ds.Tables("Categories")

ComboBox1.DisplayMember = "Description"

Ken

--------------------------

"TS" <TS@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
I configured a data adapter and generated a dataset and wrote the code to
fill the dataset with data coming from an SQL database table when my form
loads. I also changed the DataSource of a combo box to point to the
dataset.tablename and changed the DisplayMemebr to point at a column. After
the form loads nothing is populated in the combo box? Is there something I'm
missing. Please help
--
TS
Nov 21 '05 #2

P: n/a
TS,

Show a little piece of code, (first without the designer part).
(And please first pasted in a notebook and copied back to make it readable)

(I assume that you bind in the desiger and that you told in that wich
*datatable*, often is the wrong point taken to do that, so you can check
that first)

Cor
Nov 21 '05 #3

P: n/a
TS
Thanks for your reply. I tried the code you sent me and it generated the
following error message: "Unhandled Exception:
System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated
errors. Check each OLE DB status value, if available. No work was done.

Here is the code:

Dim strConn As String

Dim strSQL As String

Dim SscIntake1 As New DataSet()

Dim da As OleDb.OleDbDataAdapter

Dim conn As OleDb.OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Persist Security Info=true;Integrated
Security=false;User ID=sa;Password=xxx;database=SSC;server=zzz;"

conn = New OleDb.OleDbConnection(strConn)

da = New OleDb.OleDbDataAdapter("Select * From qmf_cint", conn)

da.Fill(SscIntake1, "qmf_cint")

ComboBox1.DataSource = SscIntake1.Tables("qmf_cint")

ComboBox1.DisplayMember = "Last_Name"

"Ken Tucker [MVP]" wrote:
Hi,

Here is an example.

Dim strConn As String

Dim strSQL As String

Dim ds As New DataSet

Dim da As OleDbDataAdapter

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * From Categories", conn)

da.Fill(ds, "Categories")

ComboBox1.DataSource = ds.Tables("Categories")

ComboBox1.DisplayMember = "Description"

Ken

--------------------------

"TS" <TS@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
I configured a data adapter and generated a dataset and wrote the code to
fill the dataset with data coming from an SQL database table when my form
loads. I also changed the DataSource of a combo box to point to the
dataset.tablename and changed the DisplayMemebr to point at a column. After
the form loads nothing is populated in the combo box? Is there something I'm
missing. Please help
--
TS

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.