我有一個(使用Microsoft Access 2007),其中包含一個名爲tbl_order
與列的表名爲PriceTesting
數據庫:顯示記錄根據月
Order_ID, Customer_Name, Dress_Type, Dress_Price, Quantity, Date_Of_Pickup, Payment_Status
我已經成功顯示使用此代碼數據到datagridview的: -
Private Sub dgvReportShow()
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\annonymous\Documents\Visual Studio 2012\Projects\TMS Final\TMS Final\db\db_TMS.accdb"
If Not con.State = ConnectionState.Open Then
con.Open()
End If
Dim ds As New DataSet
Dim dt As New DataTable
ds.Tables.Add(dt)
Dim da As New OleDb.OleDbDataAdapter
da = New OleDb.OleDbDataAdapter("SELECT Order_ID, Customer_Name, Dress_Type, Dress_Price, Quantity, Date_Of_Pickup, Payment_Status, Dress_Price * Quantity as Total " & _
"FROM tbl_order " & _
"WHERE (Payment_Status = 'paid') ", con)
da.Fill(dt)
dgvReport.DataSource = dt.DefaultView
dgvReport.SelectionMode = DataGridViewSelectionMode.FullRowSelect
End Sub
Date_Of_Pickup
顯示這樣28-Dec-13
在DataGridView (SRY ...我沒有足夠的點張貼快照)
現在我已經加入了comboboxMonth
包含月份(一月,二月,三月,...等) ,這樣我可以通過選定月份在comboboxMonth
查看記錄如何轉換在" 28-Dec-13 "
到一個月,所以我可以添加
" WHERE (Payment_Status = 'paid') AND Date_Of_Pickup = comboboxMonth.value "
誰能幫我解決了這個問題?
你怎麼填充寫組合框?只是與包含月份名稱的字符串? – Steve
是嗎..我手動在表單設計中添加月份 – WaN
因此,組合的第一個索引是月份1月等等? – Steve