Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 March 30th, 2004, 11:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, I see. Somehow I thought you were using a Microsoft Access database.

Replace the # with ' as that is the delimiter symbol for dates in SQL Server:

SELECT ID, date FROM Test WHERE (date >= '3/16/2004')

worked for me on SQL Server. Be aware that for SQL Server, this actually means: date >= '3/16/2004 12:00:00'
SQL Server takes the time part as well, so you can get some unexpected results. (especially true with a WHERE clause like
date = '3/16/2004'
as the date column will probably hold a time fragment other than 12:00....


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 30th, 2004, 11:41 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much, that's what I was missing from the line I was trying to use before. I am the worst at knowing where the delimiter's go. Oh well at least I have help :-)

Thanks again

 
Old March 30th, 2004, 12:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome.

For SQL Server it's pretty easy. Don't use delimiters for numbers money types and bit types. In all other cases, you should use the ' as a delimiter. (Hope I am not forgetting or overlooking something here)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 30th, 2004, 12:19 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One more question if you have time

SQLStr="SELECT * FROM ABNNews WHERE NewsID =" & Request.QueryString("ID")

I am getting an error

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.

what do I need to make this correct?

Thanks

 
Old March 30th, 2004, 12:46 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

To be honest, I don't know. Is NewsID a number type?

Mpost likely, Request.QueryString("ID") does not return in a valid value for NewsID. Make sure it's not empty or contains something illegal.

Usually, I do something like this:

Dim NewsID
NewsID = Request.QueryString("ID")
If NewsID & "" <> "" Then
  SQLStr = "SELECT * FROM ABNNews WHERE NewsID = " & NewsID
Else
  ' Not a valid ID
End If


You can also use

Response.Write(SQLStr)

and examine the outcome.

HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How Run .sql Script file in MS SQL Server 2000? aarkaycee SQL Server 2000 5 October 12th, 2009 05:43 AM
creating ssis packagte for sql server to sql serer Laxmikant_it ASP.NET 3.5 Professionals 0 November 26th, 2008 12:23 AM
Converting from MS SQL 2005 to Sql Epress edition saif44 SQL Language 0 February 16th, 2007 04:17 PM
Failed to copy objects from SQL server to SQL Serv monfu SQL Server 2000 4 December 4th, 2005 05:54 PM
Move SQL DB from one sql to another sql server Israr SQL Server 2000 3 January 24th, 2005 02:13 PM





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