Dim ConnnectionString As String = "?????????"
Dim Connection As New OleDbConnection(ConnnectionString)
****Dim CommandString As String = "Select [Field1], [Field2], [Field3] From [MyTable] Where [FieldDate] @StartDate And @EndDate"
Dim Commnad As New Command(CommandString, Connection)
****Command.Parameters.AddWithValue("@StartDate", DateTime.Parse("01/06/2010"))
****Command.Parameters.AddWithValue("@EndDate", DateTime.Parse("29/06/2010"))
Dim Dt As New DataTable()
Dim DataAdapter As New OleDbDataAdapter()
DataAdapter.SelectCommand = Command
DataAdapter.Fill(Dt)
รู้สึกว่า sql statement จะตก between ไปนะ เอาอันนี้แล้วกัน
Code (VB.NET)
Dim ConnnectionString As String = "?????????"
Dim Connection As New OleDbConnection(ConnnectionString)
Dim CommandString As String = "Select [Field1], [Field2], [Field3] From [MyTable] Where [FieldDate] Between @StartDate And @EndDate"
Dim Commnad As New Command(CommandString, Connection)
Command.Parameters.AddWithValue("@StartDate", DateTime.Parse("01/06/2010"))
Command.Parameters.AddWithValue("@EndDate", DateTime.Parse("29/06/2010"))
Dim Dt As New DataTable()
Dim DataAdapter As New OleDbDataAdapter()
DataAdapter.SelectCommand = Command
DataAdapter.Fill(Dt)