?
Solved

Writting SQL statment for "Search Result page" in Dream mx.

Posted on 2003-03-27
13
Medium Priority
?
153 Views
Last Modified: 2010-04-25
Hi everybody

Thanks for your time.
 I have a website connected to a table in Access xp ,on all pages which has been created from template i have put a textfiled box(with post method), for searching Title of book in table,i have also a SearchResultpage.cfm which must reterive dara from table,and for this page have created a recordset ,but for writting its sql i have problem,please help .

Thanks again for your time
mostaghassi
0
Comment
Question by:MOSTAGHASSI
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
13 Comments
 
LVL 2

Expert Comment

by:zombeen
ID: 8216645
something like this...

strsql = "select * from <table name> where title like '%" & request.form("book_title") & "%'"

Thanks
Zombeen

0
 

Author Comment

by:MOSTAGHASSI
ID: 8229798
Hi zombeen

Thanks for your comment.
Please let me know,what is "book_title"? is it the name of textbox?or name of form? i tested with these but it doesn't reterive data ofcourse i donot recieve error also,and i think the first and last qutation(") is not nessecery?.

thanks again for your time.
mostaghassi

0
 
LVL 2

Expert Comment

by:zombeen
ID: 8229851
book_title is the name of the text-box. the quotes are necessary if you are checking for a string type of field, which i think is the case with your field (title)

thanks
Zombeen
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:MOSTAGHASSI
ID: 8231635
Hi

As you know ,in dream mx when we create a recordset for a page and click on it ,open a box for writing sql,i writ this statment ,but  when test it it reterives no data.


SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and title like '%"& request.form("textfield2")
&"%'
ORDER BY title asc

thanks
0
 

Author Comment

by:MOSTAGHASSI
ID: 8231636
Hi

As you know ,in dream mx when we create a recordset for a page and click on it ,open a box for writing sql,i writ this statment ,but  when test it it reterives no data.


SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and title like '%"& request.form("textfield2")
&"%'
ORDER BY title asc

thanks
0
 

Author Comment

by:MOSTAGHASSI
ID: 8231642
Hi

As you know ,in dream mx when we create a recordset for a page and click on it ,open a box for writing sql,i writ this statment ,but  when test it it reterives no data.


SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and title like '%"& request.form("textfield2")
&"%'
ORDER BY title asc

thanks
0
 
LVL 2

Expert Comment

by:zombeen
ID: 8236537
>>>> SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and title like '%"& request.form("textfield2")
&"%'
ORDER BY title asc

what purpose is deleting_a_record solving here. What type of field it is. if it is not numeric as it appears, u wshd include quotes ard the field

Thanks
zombeen
0
 

Author Comment

by:MOSTAGHASSI
ID: 8237138
deleting_a_record is a logic field in my table,and when it is=yes it means that the records in that line can reterive,if it is =no then the sql statement ignore that record and it brings the records which are "yes".

Thanks
mostaghassi
0
 
LVL 2

Expert Comment

by:zombeen
ID: 8237222
r u sure u dont want to include them in quotes ...
'yes' in place of yes

Thanks
Zombeen
0
 

Author Comment

by:MOSTAGHASSI
ID: 8238599
I have several pages that its sql recordset is like this:

SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and "subject" = 'Miscellanous'
ORDER BY title asc

and work properly,and regarding your suggestion i used quot and even i deleted this part(deleting_a_record=yes )
and wrot like this :

SELECT *
FROM BookMainTable
WHERE title like '%"& request.form("textfield2")
&"%'
ORDER BY title asc

but it doesn't work.

thanks
mostaghassi
0
 
LVL 2

Expert Comment

by:zombeen
ID: 8243182
do you get any kind of errors...

can u print out the sql statement to find out wot values are being sent to sql statement (use response.write )

try printing out the recordcount of the recordset

Thanks
Zombeen
0
 

Author Comment

by:MOSTAGHASSI
ID: 8285310
Hi

I found what is the problem,since i use coldfusion mx as server programming it doesn't need "Request" and the codes must be like bellow,

SELECT *
FROM BookMainTable
WHERE deleting_a_record=yes and Title like '%#form.textfield2#%'

and i have defied for "page paramer" like this:
"form.textfield2" ,it works and reterive data but since i have used navigation bar(first-provious-next-last),these navigation does not work properly can u help?
thanks
mostaghassi
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 8312095
Points refunded and question closed.

Netminder
EE Admin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question