473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 4098
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

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

Similar topics

4
by: James Goodman | last post by:
I have an asp page which the user enters a time(e.g. 12:21). I need to insert this time into a SQL Server DB, which has a smalldatetime column. I have tried everything I can think of (such as...
2
by: Lauren Quantrell | last post by:
In VBA I'd use Format(myDateField,"Short Date") to display 1/31/2004 instead of 1/31/2004 10:30:25 AM How can I do this in a stored procedure? lq
1
by: Joey Martin | last post by:
How do I convert an nvarchar field to smalldatetime format? My nvarcharfield (saledatetext) is in the format YYYY-MM-DD. I want to convert is to smalldatetime (field: saledate) Thanks for...
7
by: Marc Pelletier | last post by:
Hello, I have a table with a Day field, defined as smalldatetime. I am filling it from a CSharp application with the following code: DataRow r = dtStaDays.NewRow(); r= station_ID; r =...
3
by: sunshinevaldes | last post by:
Hello all and thank you for your time. I have a datagrid where I want to view dates (smalldatetime) and be able to sort on the field. However, I do not want to have the time part show. If I...
7
by: Bostonasian | last post by:
I have a table that contains transactional data. Such as site view by whom, when, which template, etc, etc... Everytime when I pulled the report, hh:mm:ss never matters. Only breakdown by dates,...
2
by: .Net Sports | last post by:
I'm using these to assign a variable to a smalldatetime object in sql server: dim todnews = DateTime.Today.ToString ( "d" ) 'connection string to server is on this line Dim strSQL2 as string...
6
by: SQL Server | last post by:
I've been working this for a while. Kind of new to SQL Server functions and not seeing what I am doing wrong. I have this function CREATE FUNCTION dbo.test (@Group varchar(50)) RETURNS...
4
dcharnigo
by: dcharnigo | last post by:
I am converting a varchar(10) field to a smalldatetime in a stored procedure but have run into a problem. Some of the rows contain an invalid date. varchar(10) format is mm/dd/yyyy some rows are...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.