รบกวนด้วยครับ ลองหาข้อมูลใน google ดูแล้วเหมือนจะ error ง่ายแต่แก้ไม่ได้สักที
นี่โค้ดครับ
Code (VB.NET)
Public Sub combobox_province()
'Dim conn As New OleDb.OleDbConnection("Provider
Dim txt As String
Dim adapter As New SqlClient.SqlDataAdapter
Dim ds As DataSet = New DataSet
txt = "SELECT * FROM db_province order by pro_id asc"
adapter.SelectCommand = New SqlClient.SqlCommand(txt, cn)
adapter.Fill(ds)
combo_province.DataSource = ds.Tables(0)
combo_province.ValueMember = "pro_id"
combo_province.DisplayMember = "pro_name"
End Sub
Public Sub combobox_aumphor()
Dim txt As String
Dim adapter As New SqlClient.SqlDataAdapter
Dim ds As DataSet = New DataSet
txt = "SELECT * FROM db_aumphor where pro_id = '" & combo_province.SelectedValue.ToString() & "' order by aum_id asc"
adapter.SelectCommand = New SqlClient.SqlCommand(txt, cn)
adapter.Fill(ds)
combo_aumphor.DataSource = ds.Tables(0)
combo_aumphor.ValueMember = "aum_id"
combo_aumphor.DisplayMember = "aum_name"
End Sub
Public Sub combobox_tumbon()
Dim txt As String
Dim adapter As New SqlClient.SqlDataAdapter
Dim ds As DataSet = New DataSet
txt = "SELECT * FROM db_tumbon where aum_id = '" & combo_aumphor.SelectedValue.ToString() & "' order by tum_id asc"
adapter.SelectCommand = New SqlClient.SqlCommand(txt, cn)
adapter.Fill(ds)
combo_tumbon.DataSource = ds.Tables(0)
combo_tumbon.ValueMember = "tum_id"
combo_tumbon.DisplayMember = "tum_name"
End Sub
Private Sub combobox_zippost()
Dim txt As String
Dim adapter1 As New SqlClient.SqlDataAdapter
Dim ds As DataSet = New DataSet
txt = "SELECT * FROM db_tumbon where tum_id = '" & combo_tumbon.SelectedValue.ToString() & "' order by tum_id asc"
adapter1.SelectCommand = New SqlClient.SqlCommand(txt, cn)
adapter1.Fill(ds)
cust_zipcode.DataSource = ds.Tables(0)
cust_zipcode.ValueMember = "tum_id"
cust_zipcode.DisplayMember = "zippost_code"
End Sub