adding a search capability

B

bj daniels

I have a sql server (2000) and I want to add a search capability to my
asp.net page. It will search an Articles table - in particular the
'Article' field (ntext).

I started with the following statement:
sql = "Select * from [articles] where article like '%" & tbquery.text & "%'
" order by dateposted desc, title"

and the results are fine if I only enter one word into the textbox - how can
I make it more functional (using and, or and such)



bj daniels

(e-mail address removed)
 
S

S. Justin Gengo

bj,

I've taken a different direction. As a matter of fact I'm getting ready to
place the code for a search project I built out on my web site. Instead of
going to the database with a search I'm getting back a datatable of all
records and searching those. The method's I've built return a dataview.

So far it functions pretty quickly. I've tested it on up to 10,000 records
in the database of the on of the websites where I work, www.collect.com. (I
know 10,000 records isn't a lot) But in this case it's more than it seems
because this is our content database. And each article can be up to four or
five pages of text long.

It's pretty speedy so far.

I'll put the project out on my site by tomorrow.

If you want to test it I'm using it for my code library at
www.aboutfortunate.com.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
S

S. Justin Gengo

bj,

If you are interested in the search component I wrote it's on my web site in
the code library now. Just go to the code library and click the "Search"
button in the list of components on the left.

You'll have an option to download the entire project's source files and also
a help file that contains information for all the assemblies I've written.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
B

bj daniels

Can I use a validation control to only accept letters and numbers? How
would you recommend I do this?

bj daniels
(e-mail address removed)



John Saunders said:
bj daniels said:
I have a sql server (2000) and I want to add a search capability to my
asp.net page. It will search an Articles table - in particular the
'Article' field (ntext).

I started with the following statement:
sql = "Select * from [articles] where article like '%" & tbquery.text & "%'
" order by dateposted desc, title"

BJ, what happens when the user enters into tbquery something like "--
<cr><lf>DELETE * FROM [ARTICLES]<cr><lf>"?
 
B

bj daniels

thanks - I'll check that out!


S. Justin Gengo said:
bj,

If you are interested in the search component I wrote it's on my web site in
the code library now. Just go to the code library and click the "Search"
button in the list of components on the left.

You'll have an option to download the entire project's source files and also
a help file that contains information for all the assemblies I've written.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


bj daniels said:
I have a sql server (2000) and I want to add a search capability to my
asp.net page. It will search an Articles table - in particular the
'Article' field (ntext).

I started with the following statement:
sql = "Select * from [articles] where article like '%" & tbquery.text & "%'
" order by dateposted desc, title"

and the results are fine if I only enter one word into the textbox - how can
I make it more functional (using and, or and such)



bj daniels

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top