Good morning everyone.
I am trying to update an .accdb (Access 2007)
One of the rows in table is a date :
Date Type = Date/Time Format = ShortDate
This is being updated from a VB2010.Net application using a SQL Update statement
Ssql = "UPDATE Purchase_Order SET [Po_Rev_No] = " & lbl_Revision_Number.Text & _
", [Po_Owner] = '" & GlobalVariables.UserInit & "'" & _
", [Po_Type] = '" & cbo_Type.Text & "'" & _
", [Po_Proj_No] = '" & ProjNo & "'" & _
", [Po_Supplier] = '" & cbo_Supplier.Text & "'" & _
", [Po_Contact] = '" & cbo_Contact.Text & "'" & _
", [Po_Currency] = '" & theCurrency & "'" & _
", [Po_Delivery_Address] = '" & GlobalVariables.DeliveryAddr & "'" & _
", [Po_Delivery_From] = '" & cbo_Delivery_From.Text & "'" & _
", [Po_Delivery_From_Date] = #" & dtp_Delivery_Date_From.Text & "#" & _
", [Po_Delivery_To] = '" & cbo_Delivery_To.Text & "'" & _
", [Po_Delivery_To_Date] = #" & dtp_Delivery_Date_To.Text & "#" & _
", [Po_Settle_Disc] = " & mxt_Settlement_Discount.Text & _
", [Po_Pay_Terms] = '" & cbo_Payment_Terms.Text & "'" & _
", [Po_Notes] = '" & rxt_Notes.Text & "'" & _
", [Po_Incoterms] = '" & cbo_Incoterm.Text & "'" & _
", [Po_Inco_Named_Place] = '" & cbo_Inco_Named_Place.Text & "'" & _
", [Po_Inco_Place] = '" & cbo_Inco_Place.Text & "'" & _
", [Po_Submitted_Date] = #" & Today & "#" & _
", [Po_Auth_Date] = Null" & _
", [Po_Auth_By] = '" & AuthBy & "'" & _
", [Po_No_Vat] = " & chk_No_Vat.Checked & " " & _
" WHERE [Po_Number] = '" & lbl_Order_Number.Text & "'"
da = New OleDb.OleDbDataAdapter(Ssql, cn)
Try
da.UpdateCommand = New OleDbCommand(Ssql, cn)
da.UpdateCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Notify Darrell Immediately - PO Master not updated")
MsgBox(ex.ToString)
Exit Sub
End Try
ds.Clear()
da.Dispose()
The table item '[Po_Delivery_From_Date]' contains the value from a DateTimePicker.
If the date = 19/01/2013 (IE 19 January 2013) the database is updated with 19/01/2013.
If the date = 04/02/2013 (IE 4 February 2013) the database is updated with 02/04/2013 (Ie 2 April 2013) <--- THIS IS THE PROBLEM
In my Region and Language settings the short date = dd/mm/yyyy.
Can anyone please tell me why this is happening
Thanks in advance
Darrell