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

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
MOSTAGHASSIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zombeenCommented:
something like this...

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

Thanks
Zombeen

0
MOSTAGHASSIAuthor Commented:
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
zombeenCommented:
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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

MOSTAGHASSIAuthor Commented:
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
MOSTAGHASSIAuthor Commented:
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
MOSTAGHASSIAuthor Commented:
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
zombeenCommented:
>>>> 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
MOSTAGHASSIAuthor Commented:
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
zombeenCommented:
r u sure u dont want to include them in quotes ...
'yes' in place of yes

Thanks
Zombeen
0
MOSTAGHASSIAuthor Commented:
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
zombeenCommented:
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
MOSTAGHASSIAuthor Commented:
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
NetminderCommented:
Points refunded and question closed.

Netminder
EE Admin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.