I am creating a program that will use sql 2008 as a back end and have run into an issue passing the date from the program to the database, where the date is also listed as 1900-01-01 in the database. The data type in the database is smalldatetime and i am trying to only display the date.
If i change the datatype to date in the database i get the error that "sqlunhandled exception: Operand type clash: int is incompatible with date"
Ideally id like to display the date in a dd/mm/yyyy format.
Thanks for the help.
cboDate is a datetimepicker.
CODE
Dim addUser As String = "INSERT INTO tblCaseAdmin ( Digit, Day, Office, CasesReport) VALUES (" & cboDigit.Text & ", " & cboDate.Value.Date & " ,'" & cboOffice.Text & "','" & txtCasesReport.Text & "')"
Dim cmd As SqlCommand = New SqlCommand(addUser, cnn)
cmd.ExecuteNonQuery()
Ive also tried
CODE
cboDate.Value.toshortdatestring
This post has been edited by Paul Washburn: 30 Jun, 2009 - 11:55 AM