Asp form and user input

Dear Experts,

I need a bit help for solving this issue.

Theoretically the code is correct ( think), but is does not works properly.

I have 2 files: 1 html file

<form type="GET"  action="DROPDOWNDATABASEX.asp">
<input type="text" name="look_for"  value="http://www.filosofia.org/rev/bas/bas10115.htm">
<input type="submit"  value="Submit">
</form>

Open in new window


and 1 .asp file:
Dim strKeyword,look_for
	 strKeyword = Request.QueryString("look_for")
response.write strKeyword & "<br>" 


rs.open "SELECT * FROM add0 where url like 'strKeyword'  ",con

Open in new window


The message I read after running:

response.write strKeyword = http://www.filosofia.org/rev/bas/bas10115.htm

So it understand what is "strkeyword", but when I use SELECT it does the following message:

Sorry, no matching record was found.

BUT IN DATABASE THE THERE IS A REGISTER = THIS URL  !!!

If I use

rs.open "SELECT * FROM add0 where url = 'strKeyword'  ",con

Open in new window

= Sorry, no matching record was found.

However, evidently If I use

rs.open "SELECT * FROM add0 where url = "'&strKeyword&'"  ",con

Open in new window


It gives all entries with urls of the database, but I need the exactly url I entered!!!


Please, could someone help me?

Thanks

Bob K.
BOB KUSPEAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Big MontyWeb Ninja at largeCommented:
Your second query is what you want to use, your first query is asking for records where url equals the string "keywords", which obviously doesn't exist. You're not concatenating the string in your first query.
1
BOB KUSPEAuthor Commented:
Dear Big Monty


It exists:

url.jpg
1
Big MontyWeb Ninja at largeCommented:
Re-read what I wrote, your first query is looking for the string 'strKeyword'
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

BOB KUSPEAuthor Commented:
The address bar:

url2.jpg
In the body the url is shown due to response.write strKeyword

but below is the error message regarding the SELECT * from ADD0
0
Big MontyWeb Ninja at largeCommented:
What is wrong with using the 2nd query is it returns what you're looking for?
0
BOB KUSPEAuthor Commented:
Yes, but strKeyword is the variable:
strKeyword = Request.QueryString("look_for")

Open in new window


The way I wrote is not correct?

I need a variable here after url = what would be the exact match, but "accepts" only the wildcard =
"'&strKeyword&'"

Open in new window


Sincerely speaking I dont know what I am doing wrong.

Thank you for your attention
0
BOB KUSPEAuthor Commented:
The " wrong with using the 2nd query" it returns all records from field = URL and not exactly what I am looking for
0
Big MontyWeb Ninja at largeCommented:
looking on my phone, I missed the incorrect placement of the single quotes, it should be:

rs.open "SELECT * FROM add0 where url = '" & strKeyword & "'",con

Open in new window

1

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
BOB KUSPEAuthor Commented:
Thank you Big Monty

I don´t understand anymore really... but before reading your last reply I tested and this select are working fine !!!

It output the only the url I submit

rs.open "SELECT fileid, url,texts FROM add0 where url like '%" & strKeyword & "%' ", con

Open in new window


Thank you again
0
BOB KUSPEAuthor Commented:
Thank you.
0
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
ASP

From novice to tech pro — start learning today.