Sub OpenRs(sqlrs As String)
With rs
.ActiveConnection = DbConn
If .State = adStateOpen Then .Close
.CursorType = adOpenForwardOnly
.CursorLocation = adUseClient
.Open sqlrs
End With
End Sub
อันนี้คือ sub datacombo นะครับ
Code (VB.NET)
Sub dcbband()
sqlrs = "SELECT Pro_Band.Pro_band_ID, Pro_Band.Pro_band_Name FROM Pro_Band"
Call OpenRs(sqlrs)
If rs.RecordCount <> 0 Then
Set DataCombo1.RowSource = rs
DataCombo1.ListField = "Pro_band_Name"
DataCombo1.BoundColumn = "Pro_band_ID"
End If
End Sub