Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

HELP with vb

$
0
0
Trying to make drop down combobox, select all in column from a sql table. Seems like its not working, can someone please help me with this problem?The code is below..



Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim SQLSelect As New SqlCommand
Dim SQLDR As SqlDataReader
Dim SQLConnection As New SqlConnection
SQLConnection.ConnectionString = "Server=11.52.122.2;UID=admin;PWD=testsql;Database=General Log;Integrated Security=False"

SQLSelect.Connection = SQLConnection
Try
SQLConnection.Open()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
SQLSelect.CommandText = " SELECT [Part Number] FROM [ITEM_TABLE]"


SQLDR = SQLSelect.ExecuteReader
While SQLDR.Read
ComboBox1.Text = SQLDR.Item(0)
End While
SQLConnection.Close()
End Sub

Viewing all articles
Browse latest Browse all 21271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>