The is a database driven currency converter, where the program has to fetch the exchange rates from the database and display them. I created the database using Microsoft Access all the data types are set to "Currency" except the Date field where it is "Date/Time".
This is what I've done so far.
sql = "SELECT TOP 1 USD,EUR,GBP FROM dbexchangeRates WHERE Date='" & DateTimePicker1.Text.ToString & "'"
Using connection As New OleDb.OleDbConnection(strConnectionString),
command As New OleDb.OleDbCommand(sql, connection),
adapter As New OleDb.OleDbDataAdapter(command)
The problem is likely that
DateTimePicker1.Text.ToString is not returning a valid date, and this is making the query fail. Possible causes:
DateTimePicker1_ValueChangedto handle this case and not call that query.
To figure this out, use the debugger or a simple print statement to view the contents of
The problem may be obvious when you see it; if not, you can also try manually running that sql statement in Access and see what happens.