PDA

Click to See Complete Forum and Search --> : parsing Date() into database using SQL


deano1
May 20th, 2002, 03:30 AM
Hi all,

Having a little problem parsing the current date from my vb.net app into access. Both formats are setup as date so i can't see problem. The date.todat format works but comes up with completely the wrong date im truying to use the date.now format. Heres the code see what you think.

Dim dDate As Date = Date.Now

cmd.CommandText = "INSERT INTO Faults (userName, userProblem, openDate) Values ('" & strUser & "', '" & strProblem & "', " & dDate & " ) "

Thanks In Advance!

Bananafish
May 21st, 2002, 05:32 AM
Try This


Dim dDate As Date = Date.Now
Dim strDate as String

strDate = dDate.Tostring("d MMM yyyy HH:mm:ss")
cmd.CommandText = "INSERT INTO Faults (userName, userProblem, openDate) Values ('" & strUser & "', '" & strProblem & "', '" & strDate & "' ) "