Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2007, 10:03 AM
Authorized User
 
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to pushpa
Default Want Sql Query suggession

hi,

i want to execute the follwing query


dim datetemp
datetemp=trim(request.form("datefield"))

dim rs
set rs=CreateObject("ADODB.RecordSet")
rs.open "Select * from News where newsDate="&datetemp


I also try with

rs.open "Select * from News where newsDate=#"&format(datetemp,mm/dd/yyyy)&"#",GetConnection,2,2

but this give the Runtime Error-"OverFlow"


suggest me the solution for how to fire the select query withthe date filter on .asp page



 
Old February 6th, 2007, 04:18 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

If the column in the database is a datetime column you will need to put single quotes around the date:

rs.open "SELECT * from News WHERE newsDate='"&datetemp&"';"

You'll probably also want to validate that you're sending an actual date to the query.

You can also do this to check the query in Query Analyzer but I really don't know what database your using.

SQL = "SELECT * from News WHERE newsDate='"&datetemp&"';"
Response.Write(SQL)
Response.End

I don't use the open method very often so you're on your own there.

Richard






Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
SQL Query!! dpkbahuguna Beginning VB 6 5 October 12th, 2007 12:39 AM
Need suggession to develop a web application! iamrakesh22 J2EE 1 June 17th, 2007 11:53 PM
SQL query? spark SQL Language 4 June 15th, 2005 08:39 PM
Help with SQL Query jammykam SQL Language 4 October 19th, 2003 07:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.