Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-19 : 12:22:10
|
| Manish writes "hihow r uhere i need ur helpi am working on one project in which i create search engine which search data in database. during the product search, i enter a string in textbox and click go, this string is go to asp page and their i split it for search with diffrent way...strKeyword = split(Trim(Request("searchs")), " ")now suppose the database content product like thischloro amino benzenechloro amino phenolchloro amino acetic acidchloro aminoacidchloro acetic acidchlorophilchlorobenzenechloro amino benzoic acidso when i enter "chloro" for search it give result all this product listed aboveif i enter "chloro a" for search at that time i would like to get result of this product....chloro amino benzenechloro amino phenolchloro amino acetic acidchloro aminoacidchloro amino benzoic acidand if i enter "chloro amino b" i want result like ....chloro amino benzenechloro amino benzoic acidfor that i use the this coding ....Select Case UBound(strKeyword) Case 0 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' order by Product_sell desc", con, adOpenForwardOnly, adLockReadOnly, adCmdText Case 1 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' order by Product_sell desc", con Case 2 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' and Product_sell like '" & strKeyword(2) & "%' order by Product_sell desc", con Case Else rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' and Product_sell like '" & strKeyword(2) & "%' order by Product_sell desc", conEnd Selecthere i make some mistake so i can't get the result which i want,so please help me and solve my probleami also want to ignor numeric value and any type of symbol (like & * ( ) ! @ # $ % { } { [ ] , . / _ - = + " ' : ; and numaric value 0 to 9)for that what change i have to make in this codeit means if some one enter "2 chloro amino benzene" or "2-chloro amino benzene" or "4, chloro amino benzene" or "2:chloro amino benzene" etc... different way it reflact chloro amino benzene in result, ignor numaric value 2 or 4 and also symbol "-" or "," or ": "hope u understand what i mean to say, rightthe another question isi have some company name such as...cadila pharmaceutical limitedbayer ag ltdshanghai intermediates ltdanand chemical and intermediates pvt ltdnow i want query which select first char of string's each word. meansfor cadila pharmaceutical limited i want "cpl"for bayer ag ltd i want "bal"for shanghai intermediates ltd i want "sil"for anand chemical and intermediates pvt ltd i want "acaipl"hope u understand which type of query i want so please reply me soonsolve my probleam and reply me soonas early as possibleokmanish" |
|
|
mAdMaLuDaWg
Starting Member
42 Posts |
Posted - 2002-06-19 : 17:53:17
|
quote: Manish writes "hihow r uhere i need ur helpi am working on one project in which i create search engine which search data in database. during the product search, i enter a string in textbox and click go, this string is go to asp page and their i split it for search with diffrent way...strKeyword = split(Trim(Request("searchs")), " ")now suppose the database content product like thischloro amino benzenechloro amino phenolchloro amino acetic acidchloro aminoacidchloro acetic acidchlorophilchlorobenzenechloro amino benzoic acidso when i enter "chloro" for search it give result all this product listed aboveif i enter "chloro a" for search at that time i would like to get result of this product....chloro amino benzenechloro amino phenolchloro amino acetic acidchloro aminoacidchloro amino benzoic acidand if i enter "chloro amino b" i want result like ....chloro amino benzenechloro amino benzoic acidfor that i use the this coding ....Select Case UBound(strKeyword) Case 0 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' order by Product_sell desc", con, adOpenForwardOnly, adLockReadOnly, adCmdText Case 1 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' order by Product_sell desc", con Case 2 rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' and Product_sell like '" & strKeyword(2) & "%' order by Product_sell desc", con Case Else rs.Open "select * from m where Product_sell like '" & strKeyword(0) & "%' and Product_sell like '" & strKeyword(1) & "%' and Product_sell like '" & strKeyword(2) & "%' order by Product_sell desc", conEnd Selecthere i make some mistake so i can't get the result which i want,so please help me and solve my probleami also want to ignor numeric value and any type of symbol (like & * ( ) ! @ # $ % { } { [ ] , . / _ - = + " ' : ; and numaric value 0 to 9)for that what change i have to make in this codeit means if some one enter "2 chloro amino benzene" or "2-chloro amino benzene" or "4, chloro amino benzene" or "2:chloro amino benzene" etc... different way it reflact chloro amino benzene in result, ignor numaric value 2 or 4 and also symbol "-" or "," or ": "hope u understand what i mean to say, rightthe another question isi have some company name such as...cadila pharmaceutical limitedbayer ag ltdshanghai intermediates ltdanand chemical and intermediates pvt ltdnow i want query which select first char of string's each word. meansfor cadila pharmaceutical limited i want "cpl"for bayer ag ltd i want "bal"for shanghai intermediates ltd i want "sil"for anand chemical and intermediates pvt ltd i want "acaipl"hope u understand which type of query i want so please reply me soonsolve my probleam and reply me soonas early as possibleokmanish"
I think you would be better off posting on an ASP forum. Try www.gotdotnet.com or www.asphole.com |
 |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-06-20 : 11:56:22
|
| With the keyword search, I've done something almost exactly like that.This is the article that I used to create my search.http://www.sqlteam.com/item.asp?ItemID=5857You really need to move your data access code to stored procs, and then call those stored procs from ASP.With the second question, that's a bit tougher. I know you'll need to use substring to find the right parts. The article above has some examples on how to use substring, so that should put you in the ballpark.Michael |
 |
|
|
|
|
|
|
|