Hello guys,
I am trying to add date range with the combobox value when a user clicks the "Enter" button. This is my code so far:
Dim con As New OleDbConnection(Get_Constring)
Dim dt As New DataTable
con.Open()
Dim da As New OleDbDataAdapter("SELECT * from EncodingComplete where Date_Bill BETWEEN @startDate AND @endDate AND Client like @client Order by Date_Bill desc" , con)
With da.SelectCommand.Parameters
With da.SelectCommand.Parameters
.AddWithValue("@startDate", DateTimePicker1.Value)
.AddWithValue("@endDate", DateTimePicker2.Value)
.AddWithValue("@client", ComboBox1.Text & "%")
End With
End With
da.Fill(dt)
DataGridView1.DataSource = dt
con.Close()
The error is in my SQL statement, which says:
Error 1 Value of type 'String' cannot be converted to 'System.Data.OleDb.OleDbCommand'. C:\Users\david\Documents\Visual Studio 2008\Projects\Golden Dragon Billing System\Golden Dragon Billing System\AfterfrmMain\frmSOA.vb 100 40 Golden Dragon Billing System
Please please help me!!