Friend,
I have a question about date conversion. I'm coding a SQL INSERT query in VB.NET platform. The code work just fine and the date conversion work just fine also. I use MS Access database to store the data. I setup the "Dates" field in MS Access as Date/Time with short date format. I notice that whenever I insert the data into the database, the date field is listed as "12/30/1899" and not the date that I wanted (ex...12/30/2005). Also, when I search for the date (ex..12/30/005), the search come back with a result. I'm not sure what might cause this problem. Please help, my code is listed below.
I have a question about date conversion. I'm coding a SQL INSERT query in VB.NET platform. The code work just fine and the date conversion work just fine also. I use MS Access database to store the data. I setup the "Dates" field in MS Access as Date/Time with short date format. I notice that whenever I insert the data into the database, the date field is listed as "12/30/1899" and not the date that I wanted (ex...12/30/2005). Also, when I search for the date (ex..12/30/005), the search come back with a result. I'm not sure what might cause this problem. Please help, my code is listed below.
VB.NET:
OleDataAdapter.InsertCommand.CommandText = _
"INSERT INTO Expense(Amount, Dates, Debit, Credit, " & _
"ExpenseType, PaymentMethod, Summary) " & _
"VALUES(" & Val(txtAmount.Text) & " , " & _
"" & CType(txtDate.Text, DateTime) & " , " & _
"'" & radDebit.Checked & "' , '" & radCredit.Checked & "' , " & _
"'" & cboExpType.SelectedItem & "' , " & _
"'" & cboPayMethod.SelectedItem & "' , " & _
"'" & txtSummary.Text & "')"
Last edited by a moderator: