Private Sub frmtttdl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Using con As New SqlConnection(strcon)
con.Open()
Dim cm As New SqlCommand("select GroupID,transportid,transportname from tbltran where GroupID =" & t & "", con)
Using dr As SqlDataReader = cm.ExecuteReader
If dr.HasRows Then
Dim dt As New DataTable
dt.Load(dr)
With cb1
.ValueMember = "transportid"
.DisplayMember = "transportname"
.DataSource = dt
End With
End If
End Using
End Using
End Sub
End Class
DB ขนส่งครับ
ช่วยผมทีครับ
Tag : .NET, VB.NET
ประวัติการแก้ไข 2011-08-02 17:31:55
Date :
2011-08-02 17:29:30
By :
crazy-Ugly
View :
6033
Reply :
10
No. 1
Guest
Code (VB.NET)
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim cm As New SqlCommand("select GroupID,transportid,transportname from tbltran where transportname = '"&ComboBox1.text&"', con)
dim dr As SqlDataReader = cm.ExecuteReader
textbox.text = dr("transportid")
End Sub