Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objConn As New System.Data.SqlClient.SqlConnection
Dim objCmd As New System.Data.SqlClient.SqlCommand
Dim dtAdapter As New System.Data.SqlClient.SqlDataAdapter
Dim ds As New DataSet
Dim dt As DataTable
Dim strConnString, strSQL As String
strConnString = "Server=161.246.195.44; User ID=peepo;PASSWORD=123456;database=kmitl_database;"
strSQL = "SELECT * FROM prefix;"
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dt = ds.Tables(0)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "pr_name"
ComboBox1.ValueMember = "pr_code"
End Sub
ตอน run ไม่มี error แต่ว่าใน combobox มันไม่มีอะไรมาโชว์เลยอะครับ ช่วยผมที