469,934 Members | 2,607 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

smalldatetime convert error

Hi I am passing Date value form .asp form like "3/15/2007"


And i am geting error
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting character string to smalldatetime data type.



strSlq = "SELECT SUM(pieces) AS piecesTotal" _
& " FROM orders" _
& date_ordered > convert(datetime,'" & Dateordered & "',102)"
rs.Open strSql, cn

In MS SQL Server the Date_ordered field is smalldatetime, and stores the date values like 6/15/2007.

where do i convert what, I need help....pls
Jul 10 '07 #1
2 3978
jhardman
3,406 Expert 2GB
you mean:
Expand|Select|Wrap|Line Numbers
  1. strSlq = "SELECT SUM(pieces) AS piecesTotal" _
  2. & " FROM orders" _
  3. &  " WHERE date_ordered > #" & convert(datetime, Dateordered ,102) & "#"
  4. rs.Open strSql, cn
? Let me know if this works for you.

Jared
Jul 11 '07 #2
Cintury
81
Hi I am passing Date value form .asp form like "3/15/2007"


And i am geting error
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting character string to smalldatetime data type.



strSlq = "SELECT SUM(pieces) AS piecesTotal" _
& " FROM orders" _
& date_ordered > convert(datetime,'" & Dateordered & "',102)"
rs.Open strSql, cn

In MS SQL Server the Date_ordered field is smalldatetime, and stores the date values like 6/15/2007.

where do i convert what, I need help....pls
I'm not 100% but you may want to change that strSlq on your first statement to be the same as that rs.Open strSql...
Aug 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by James Goodman | last post: by
2 posts views Thread by Lauren Quantrell | last post: by
1 post views Thread by Joey Martin | last post: by
7 posts views Thread by Marc Pelletier | last post: by
3 posts views Thread by sunshinevaldes | last post: by
2 posts views Thread by .Net Sports | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.