Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 3rd, 2003, 11:42 PM
the_sleeper the_sleeper is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Baltimore
Posts: 3 the_sleeper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Question on : #" & varDOBStart "# AND #" & varDOBEnd & "#;"

THIS WORKS...

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''
sqltext = "Select * from People "
sqltext = sqltext & "WHERE PeopleDOB between "
sqltext = sqltext & "#" & varDOBStart
sqltext = sqltext & "# AND #" & varDOBEnd & "#;"
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''

THIS DOES NOT....(assume string is ALL ON ONE LINE)

sqltext = "Select * from People WHERE PeopleDOB between #" & varDOBStart "# AND #" & varDOBEnd & "#;"

Since I am learning I really dont have a clue as to why. I T-H-I-N-K it has something to do with the formatting of the date info. But I CANNOT figure it out. Even though the code above works, I dont understand WHY it works...i think thats rather danger...can someone explain please?

Reply With Quote
  #2  
Old March 4th, 2003, 07:24 AM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 6
Well, for one thing you're missing an ampersand after varDOBStart in the second example...

Reply With Quote
  #3  
Old March 6th, 2003, 08:19 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
If you ever think you have something wrong with a string - do a reposnse.write on it - you'll quickly see what the problem is.

Response.write() is your friend!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Question on : #" & varDOBStart "# AND #" & varDOBEnd & "#;"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway