i have in my page an input text with a date like this "18/10/2005" i need to
convert this value to lunch a select on SQL2000 like this "WHERE
(dataAssunzione = CONVERT(DATETIME, '2005-10-18 00:00:00', 102))"
How can i convert this date ?
Re: Date Conv
> i have in my page an input text with a date like this "18/10/2005" i
> need to convert this value to lunch a select on SQL2000 like this
> "WHERE (dataAssunzione = CONVERT(DATETIME, '2005-10-18 00:00:00',
> How can i convert this date ?
Do the Regional Settings on your server allow this text to be recognized as
a date? I.E., does this statement raise an error?
If this statement runs without error, see
Otherwise, you will need to use basic string functions (Left, Mid and Right)
to extract the date elements and recombine them into a database-friendly
PS. you are going to unnecessary trouble in your example sql statement. All
that is required is:
WHERE dataAssunzione = '20051018'
No need for the parentheses and no need for the CONVERT function.
Also, given the lack of a parameter in te above example, it looks like you
are planning to use dynamic sql to create and run this query. if so, please
The surest way to defeat sql injection is to use parameters, either by using
a Command object to pass parameter values to a string containing parameter
or by using my preferred method of using stored procedures:
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
|All times are GMT. The time now is 11:38 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.