Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

VS 2008 Sql server update date with wrong value

$
0
0
hello all

i have this code code that update insert record in the SQL Server database
Code:

Dim rs As New SqlCommand("INSERT INTO " & sTable & " (TireID,RFID,Model,[Tire Size],InitialBrandingDate,Installed,Location,[Recommended Inflation]) Values('" & sValues(0) & "','" & sValues(1) & "','" & sValues(2) & "','" & sValues(3) & "','" & DateTime.Now & "',0,'" & _DEFAULT_LOCATION & "'," & Psi & ")", _DBConn_LOCAL)
 rs.ExecuteNonQuery

I used the datetime.now to get the current date and time value to be saved in the database. When I checked the value inserted into the server the InitialBrandingDate value has different value than i expected.

when I used msgbox(datetime.now) it shows 4/30/2013 3:56:26 PM but the server has this value "2013-4-30 6:56:26.000" when i Tried to call this value from the server using mm/dd/yyyy hh:mm tt format it is showing " 04/30/2013 6:56 AM"

I dont know what is going on please help.

Thank you.

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>