Binding combo box

G

Guest

I configured a data adapter and generated a dataset to access data
coming from an SQL database table when my form loads. After the form loads
nothing is populated in the combo box that supposed to be bound to a column
in the database table. Someone in this newsgroup thankfully told that I still
have to write some codes to populate the combo box with data. Here is the
code he sent me and that I tried on my application. The codes return 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". Can
someone please tell me how to make this code work?

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"
 
K

Ken Tucker [MVP]

Hi,

Your connection string is wrong

strConn &= "Data Source = Persist Security Info=true;Integrated
Security=false;User ID=sa;Password=xxx;database=SSC;server=zzz;"


Here is an example
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = C:\Northwind.mdb;"



Ken

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

I configured a data adapter and generated a dataset to access data
coming from an SQL database table when my form loads. After the form loads
nothing is populated in the combo box that supposed to be bound to a column
in the database table. Someone in this newsgroup thankfully told that I
still
have to write some codes to populate the combo box with data. Here is the
code he sent me and that I tried on my application. The codes return 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". Can
someone please tell me how to make this code work?

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"
 
G

Guest

Thanks, but I'm getting confused now. The server where the SQL database
resides is USEGNYDC3\CLIENT_DB and the database name is SSC.
I tried the following connection string:
strConn &= "Data Source = \\USEGNYDC3\CLIENT_DB\SSC.mdb;" and got an error
message. What should the connection string be then?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top