Me.DataTable1TableAdapter.Fill(Me.PlannedITEquip.DataTable1)
Dim objConn As New OleDbConnection
Dim objCmd As OleDbCommand
Dim dtAdapter As New OleDbDataAdapter
Dim ds As New DataSet
Dim dt As DataTable
Dim strConnString, strSQL As String
strConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\paweenawat\Documents\Visual Studio 2010\Visual Studio 2010\Projects\PMCBL\PMCBL\PMCBL\PMCBL\PMCBL\PMCBL\PMCBL\PMCBL_ITINV_V0.8.accdb"
'objConn = New OleDbConnection(strConnString)
objConn.ConnectionString = strConnString
objConn.Open()
strSQL = "SELECT * FROM IT_Description order by ItemNo asc"
objCmd = New OleDbCommand
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
txtItemNo.DataSource = dt
txtItemNo.DisplayMember = "ItemNo"
txtItemNo.DisplayMember = "Item_Desc"
txtItemNo.ValueMember = "ItemNo"
ตอนนี้ combobox ขึ้นช่องเดียว
อยากให้เป็นแบบนี้อ่ะครับ
ต้องแก้ไขcodeตรงไหนอ่ะครับ
Tag : .NET, Ms Access, Win (Windows App), VB.NET, VS 2010 (.NET 4.x), Windows