G
Guest
Hi folks,
I have 2 code snippets. One works and one does not.
This first hard-coded snippet works
Dim queryString As String = "UPDATE [rfi] SET [dateresolved] = '8/16/2006'
WHERE ([rfi].[id] = @id)"
This second snippet does not work
Dim dtNow As DateTime = DateTime.Now
dRes = dtNow.ToShortDateString
Dim queryString As String = "UPDATE [rfi] SET [dateresolved] = dRes WHERE
([rfi].[id] = @id)"
dateresolved is a Date/Time data-type. The first snippet uses single quotes
around the date but I would think the second snippet would be accepted as a
string. If I debug the value of dRes, I receive the proper format of
"8/16/2006"
Any clues you can leave me with?
Thanks,
- Glenn
I have 2 code snippets. One works and one does not.
This first hard-coded snippet works
Dim queryString As String = "UPDATE [rfi] SET [dateresolved] = '8/16/2006'
WHERE ([rfi].[id] = @id)"
This second snippet does not work
Dim dtNow As DateTime = DateTime.Now
dRes = dtNow.ToShortDateString
Dim queryString As String = "UPDATE [rfi] SET [dateresolved] = dRes WHERE
([rfi].[id] = @id)"
dateresolved is a Date/Time data-type. The first snippet uses single quotes
around the date but I would think the second snippet would be accepted as a
string. If I debug the value of dRes, I receive the proper format of
"8/16/2006"
Any clues you can leave me with?
Thanks,
- Glenn