G
Guest
Hi all,
From my windows form, I opened a connection to a SQL database. Now I need to
generate a combo box from a SELECT statement pointing to the last name column
in the SQL tables. I am stuck with the code I should use to generate this
combo box. I used to use ADO to open a connection to SQL in VB6 then use Do
until EOF - Loop to loop through the recodset and the cbo.additems to place
the result of the recordset in the combo box. With .Net I am lost.The code I
used to open a connection to the SQL database in the .net form is the
following:-
Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection
SQLEV.ConnectionString = "Persist Security Info=true;Integrated
Security=false;User
ID=sa;Password=demento;database=SSC;server=USEGNYDC3\CLIENT_DB"
SQLEV.Open()
Dim SQLLine As String
SQLLine = "SELECT last_name FROM qmf_cint"
Dim objcmd As New SqlClient.SqlCommand(SQLLine, SQLEV)
What should I do next?
From my windows form, I opened a connection to a SQL database. Now I need to
generate a combo box from a SELECT statement pointing to the last name column
in the SQL tables. I am stuck with the code I should use to generate this
combo box. I used to use ADO to open a connection to SQL in VB6 then use Do
until EOF - Loop to loop through the recodset and the cbo.additems to place
the result of the recordset in the combo box. With .Net I am lost.The code I
used to open a connection to the SQL database in the .net form is the
following:-
Private Sub ConnectSQL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection
SQLEV.ConnectionString = "Persist Security Info=true;Integrated
Security=false;User
ID=sa;Password=demento;database=SSC;server=USEGNYDC3\CLIENT_DB"
SQLEV.Open()
Dim SQLLine As String
SQLLine = "SELECT last_name FROM qmf_cint"
Dim objcmd As New SqlClient.SqlCommand(SQLLine, SQLEV)
What should I do next?