hobbes2103
Active member
- Joined
- Jul 10, 2003
- Messages
- 43
I have this code that selects people who are born after 31/12/1980 :
Dim MyCon As New OleDb.OleDbConnection
Dim myReader As OleDb.OleDbDataReader
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Application.StartupPath & "\" & "mydatabase.mdb;"
MyCon = New OleDb.OleDbConnection(myConnectionString)
MyCon.Open()
Dim myCommand As New OleDb.OleDbCommand
Dim mySelect As String = "SELECT name, age FROM MyTable WHERE birthdate >31/12/1980"
myCommand = New OleDb.OleDbCommand(mySelect, MyCon)
The problem comes from the selection by date because if I select by name or by age, it works.
How do i have to write the 31/12/1980 so that there is no "unhandled exception"?
Thank you!
Dim MyCon As New OleDb.OleDbConnection
Dim myReader As OleDb.OleDbDataReader
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Application.StartupPath & "\" & "mydatabase.mdb;"
MyCon = New OleDb.OleDbConnection(myConnectionString)
MyCon.Open()
Dim myCommand As New OleDb.OleDbCommand
Dim mySelect As String = "SELECT name, age FROM MyTable WHERE birthdate >31/12/1980"
myCommand = New OleDb.OleDbCommand(mySelect, MyCon)
The problem comes from the selection by date because if I select by name or by age, it works.
How do i have to write the 31/12/1980 so that there is no "unhandled exception"?
Thank you!