|
 |
asp_databases thread: RE: Date Problem
Message #1 by "Nitai" <nitai@s...> on Mon, 8 Apr 2002 14:45:23 +0530
|
|
hi,
use the following code
date_occurred=request.querystring("Value")
SQL="SELECT * FROM physician where created_date = '"& date_occurred & "'"
response.write SQL
RS.Open SQL, MyConn
Nitai Mahato <mailto:nitai@s...>
Internet Technologist
Studentsguild.com Pvt. Ltd.
Office : +xx-xx-xxxxxxx
Fax: +xx-xx-xxxxxxx
Email: nitai@s... <mailto:nitai@s...>
http://www.studentsguild.com/reflex.html
http://www.studentsguild.com <http://www.studentsguild.com/>
This e-mail, its content and any files transmitted with it are intended
solely for the
addressee(s) and may be legally privileged and/or confidential. Access by
any other party
is unauthorised without the express written permission of the sender. If you
have
received this e-mail in error you may not copy or use the contents,
attachments or
information in any way. Please destroy it and contact the sender via return
e-mail.
This e-mail has been prepared using information believed by the author to be
reliable and
accurate, but Studentsguild.com Pvt. Ltd. makes no warranty as to its
accuracy or
completeness. In particular Studentsguild.com Pvt. Ltd. does not accept
responsibility
for changes made to this e-mail after it was sent.
-----Original Message-----
From: urmilla [mailto:urmi_tikoo@m...]
Sent: Saturday, April 06, 2002 11:11 AM
To: ASP Databases
Subject: [asp_databases] Date Problem
Hello,
I am facing problem with date.I have got a form in which i put in the
date.The format of date is mm/dd/yy
e.g 4/6/2002
This value i am storing in a variable.
Then i am writing an sql query where i am calling this date stored in
avariable.If this date is present in the database it should show me the
records.
Syntax is follows:-
---------------------------
date_occurred=request.querystring("Value")
SQL="SELECT * FROM physician where created_date = #"&date_occurred&"#"
response.write SQL
RS.Open SQL, MyConn
Error Code:-
-----------------------------------------------------------------
SELECT * FROM physician where created_date = #4/6/2002#
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near '#'.
/admin/reports/phyreportsearch.asp, line 44
Kindly pls help
Message #2 by "Kim Iwan Hansen" <kimiwan@k...> on Sat, 6 Apr 2002 15:48:58 +0200
|
|
in sql server you have to use '' around dates (same as text strings).
select * from physician where created_date = '4/6/2002'
-Kim
-----Original Message-----
From: urmilla [mailto:urmi_tikoo@m...]
Sent: 6. april 2002 11:51
To: ASP Databases
Subject: [asp_databases] Re: Date Problem
Hello,
The soln provided didn't do anything it is repeating the same error as
SELECT * FROM physician where created_date = #4/6/2002#
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near '#'.
/admin/reports/phyreportsearch.asp, line 44
Regards
Message #3 by arshad siddiqui <ash_arshad@y...> on Sat, 6 Apr 2002 06:07:43 -0800 (PST)
|
|
Hi,
In Ms access you have to use hash symbol before and
after the variable.but in sql server it takes date as
a string.so try this out
SELECT * FROM physician where created_date ='variable'
if again the issue is unresolved,please let me know.
Bye
--Arshad--
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
Message #4 by "urmilla" <urmi_tikoo@m...> on Sat, 6 Apr 2002 11:10:37
|
|
Hello,
I am facing problem with date.I have got a form in which i put in the
date.The format of date is mm/dd/yy
e.g 4/6/2002
This value i am storing in a variable.
Then i am writing an sql query where i am calling this date stored in
avariable.If this date is present in the database it should show me the
records.
Syntax is follows:-
---------------------------
date_occurred=request.querystring("Value")
SQL="SELECT * FROM physician where created_date = #"&date_occurred&"#"
response.write SQL
RS.Open SQL, MyConn
Error Code:-
-----------------------------------------------------------------
SELECT * FROM physician where created_date = #4/6/2002#
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near '#'.
/admin/reports/phyreportsearch.asp, line 44
Kindly pls help
Message #5 by arshad siddiqui <ash_arshad@y...> on Sat, 6 Apr 2002 02:14:12 -0800 (PST)
|
|
Hi,
There is no error in your code,It should work fine.
You may try :
date_occured = Trim(request("Value"))
This may work
still any problem,please let me know.
Bye
--Arshad--
--- urmilla <urmi_tikoo@m...> wrote:
> Hello,
> I am facing problem with date.I have got a form in
> which i put in the
> date.The format of date is mm/dd/yy
> e.g 4/6/2002
> This value i am storing in a variable.
> Then i am writing an sql query where i am calling
> this date stored in
> avariable.If this date is present in the database it
> should show me the
> records.
> Syntax is follows:-
> ---------------------------
> date_occurred=request.querystring("Value")
> SQL="SELECT * FROM physician where created_date
> #"&date_occurred&"#"
> response.write SQL
> RS.Open SQL, MyConn
>
> Error Code:-
>
-----------------------------------------------------------------
> SELECT * FROM physician where created_date
> #4/6/2002#
> Microsoft OLE DB Provider for ODBC Drivers error
> '80040e14'
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line
> 1: Incorrect syntax
> near '#'.
>
> /admin/reports/phyreportsearch.asp, line 44
>
>
> Kindly pls help
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
Message #6 by "urmilla" <urmi_tikoo@m...> on Sat, 6 Apr 2002 11:50:33
|
|
Hello,
The soln provided didn't do anything it is repeating the same error as
SELECT * FROM physician where created_date = #4/6/2002#
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near '#'.
/admin/reports/phyreportsearch.asp, line 44
Regards
Message #7 by "Drew, Ron" <RDrew@B...> on Sat, 6 Apr 2002 15:46:38 -0500
|
|
Error indicates you are using a SQL Server ODBC Driver. You use # with
Access. With SQL Server you use quotes.
SELECT * FROM physician where created_date =3D '4/6/2002';
If that does not work, check the column definition again in the DB
-----Original Message-----
From: urmilla [mailto:urmi_tikoo@m...]
Sent: Saturday, April 06, 2002 6:51 AM
To: ASP Databases
Subject: [asp_databases] Re: Date Problem
Hello,
The soln provided didn't do anything it is repeating the same error as
SELECT * FROM physician where created_date =3D #4/6/2002#
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near '#'.
/admin/reports/phyreportsearch.asp, line 44
Regards
|
|
 |