ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 1st, 2011, 03:28 PM
HumphreyBumpkin HumphreyBumpkin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Location: England
Posts: 1 HumphreyBumpkin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 48 sec
Reputation Power: 0
Passing parameters in .asp to build SQL select string

Apologies for any lack of protocol I don't use forums much.

I am using Frontpage 2003 ( old I know but it's all I have available ) trying to pass a few simple parameters from one .asp page to another in which I want to use the received parameters to build a SQL string e.g. "Select * from xyzfile where field 1=parameter1 AND field 2 = parameter 2" to read data from an Access database.

I can actually achieve this as long as the AND is hard coded in the string that I build. However if I include a parameter3 from the first page which enables me to select and AND or an OR I am unable to get the SQL string to work.

E.G. I can build an SQL string "Select * from Tablex where Field1='::Parameter1::' AND Field2='::Parameter2::'" and it works.

But if I build it to accomodate the 3rd parameter as follows : "Select * from Tablex where Field1='::Parameter1::' " + '::Parameter3::' + "Field2='::Parameter2::'" it fails.

No matter what I do with ' " + & it seems that the parameters can be read as values for comparison but not as part of the SQL statement itself.

Is there a way round this please.

I hope I've made myself clear and apologise if not. I'm not at work so the actual code is not available but if necessary I could post it in the future.

Thanks in anticipation.

Reply With Quote
  #2  
Old December 1st, 2011, 09:28 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 18th Plane (13500 - 13999 posts)
 
Join Date: Jun 2003
Posts: 13,894 Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level)Doug G User rank is General 49th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 4 Days 15 h 10 m 20 sec
Reputation Power: 4227
One tip, use & to concatenate not +

You'll probably need to put the literal strings AND and OR in variables, then use whichever is appropriate when building your sql string.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Passing parameters in .asp to build SQL select string


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap