Jacksparrow87
Technical User
Hi people,
I'm facing this problem where I need to save the date from the date time picker into my sql database. However the date format on the sql database is set as US format where I need it to be UK, the alternative I have found is to pass the date in as a parameter (so that the actual date value is saved) I have got to the following coding:
Now the problem is that the date that gets saved is blank, there is no date what so ever and the value that is saved in dol is empty.
Any help or ideas please?
I'm facing this problem where I need to save the date from the date time picker into my sql database. However the date format on the sql database is set as US format where I need it to be UK, the alternative I have found is to pass the date in as a parameter (so that the actual date value is saved) I have got to the following coding:
Code:
Dim conn As New SqlConnection("Data Source= Wk3-dbserver;Initial Catalog= supporttest;Integrated Security=SSPI")
Dim cmd As New SqlCommand
With cmd
.CommandType = CommandType.Text
.Connection = conn
If _ID = 0 Then
.CommandText = "INSERT [Log] (dol) values (@p1)"
Else
.CommandText = "UPDATE Log SET Dol=@p1 WHERE ID=@p2"
.Parameters.Add(New SqlParameter("@p2", _ID))
End If
.Parameters.Add(New SqlParameter("@p1", Me.dtp.Value))
End With
conn.Open()
cmd.ExecuteNonQuery()
Now the problem is that the date that gets saved is blank, there is no date what so ever and the value that is saved in dol is empty.
Any help or ideas please?