Dim objConn As New System.Data.SqlClient.SqlConnection()
Dim dtAdapter As New System.Data.SqlClient.SqlDataAdapter()
Dim dt As New DataTable()
Dim strConnString As [String]
strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn = New System.Data.SqlClient.SqlConnection(strConnString)
objConn.Open()
Dim strSQL As [String]
strSQL = "SELECT * FROM customer"
dtAdapter = New System.Data.SqlClient.SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
Me.listBox1.DataSource = dt
Me.listBox1.DisplayMember = "Name"
Me.listBox1.ValueMember = "CustomerID"