How To Create This Simple Database Search? Thank You.

Dec 7, 2004

Hello,





I have a search form in an ASP.NET/VB page. The form has the input text box and the button "search". The keywords are passed in the URL to results.aspx.





Here is an example of what I get in the URL, when I write the keywords "asp", "book" and "london" in the input text box and click "search":


results.aspx?search=asp%20book%20london





The database table has 3 fields: "id", "title" and "description".





I want to display all the records where at least one of the keywords is found in any of the 2 fields "title" and "description".





1. I suppose I need to get the words out of the URL to be used by SQL.


Maybe: string[] searchString = request.queryString("search").split('search'); ???


How can i make this run when page loads? I supose i need it. Right?





2. How should the SQL look? I supose i need to use the "Like" command


SELECT * FROM books WHERE title LIKE ...


But how to I use it if I can have 1, 2, 3, ... keywords?





Can someone help me?





Thanks,


Miguel

View 1 Replies


ADVERTISEMENT

How Do You Create A Multiple Word Search Box To Return Rows From A Sql Database In Asp.net 2.0

Jun 12, 2007

I am using VS2005 to construct a website. I have a sql database with 3 datasets. One of the table adapters is called Proudcts and has the following fields. ProductItem,    Description,   Price,    ProductID,    PackSizeI want to be able to see a summary of the products (there are thousands of them) using one or more words (or partial words) in one text box to search in only 3 fields (ProductItem,    Description,   ProductID, ). This needs to show only records which contain the search criteria in a gridview?This is such a basic requirement for a website, and can be found on many sites, but I haven't found how to do it.Thanks, Bri 

View 7 Replies View Related

Create Site Search Using Sql Server Full Text Search

Jul 24, 2007

would you use sql server "full text search" feature as your site index?  from some reason i can't make index server my site search catalog, and i wonder if the full text is the solution. i think that i wll have to you create new table called some thing like "site text" and i will need to write every text twice- one the the table (let's say "articles table") and one to the text. other wise- there is problems finding the right urlof the text, searching different tables with different columns name and so on...
so i thought create site search table, with the columns:
id, text, url
and to write every thing to this table.
but some how ot look the wrong way, that every forum post, every article, album picture or joke will insert twice to the sqr server...
what do you think? 

View 1 Replies View Related

Simple SQL Search

Jul 11, 2006

Hi, Im trying to create a simple search page to return a list of products from a table in a sql database. Id like to be able to search a product description column in a table I have called products using the contents of a text box. I was wondering how i can go about getting the search to check for all words the user types in rather than just a single word or an exact phrase. Im currently using the following sql query
SELECT [product_title], [product_description] FROM [products] WHERE ([product_description] LIKE '%' + @product_search + '%')
this works fine for single words and exact phrases but if i had product called 'fred w bloggs' and i enter 'fred bloggs' it will not return anything.
Please could anyone suggest how i shoud go about this?
Im not sure if my web hosting company will enable full text search or will this be required?
Thanks for any help!
pete_ (very new to asp.net!)

View 1 Replies View Related

A Simple Search

Feb 10, 2008

Hi all I need to implement a search function in Asp.net. Its nothing complicated, just find out whether a value exists in a particular table and return a boolean accordingly. However, the table has about 300,000 records. Is simply querying the table from the web (SELECT barcode FROM tblProducts where ID=123) the best way considering the releant column has been indexed.Any pointers would be appreciated. Thanks   

View 4 Replies View Related

Simple Search Help

Mar 16, 2008

Hello new in sql and asp.net here.I have this Select * from InvoiceHeader where TransactionDate > '03/16/2008' That code isn't working instead of returning a row with a transaction date that is greater than 3/16/2008 what it return is all the row. How can  fix this? Thanks! 

View 9 Replies View Related

A Simple Search

Mar 24, 2008

I have a table of articles:

-------------------------------------
Articles
-------------------------------------
ID | Date | Headline | Body
-------------------------------------

I'm trying to write a stored procedure that will search for a given keyword. Here's what I have:

CREATE PROCEDURE sproc_SearchArticles
(
@keyword varchar(50)
)
AS
SELECT ID, Date, Headline, Body
FROM Articles
WHERE Body LIKE %@keyword%
ORDER BY Date DESC
RETURN


That keeps giving me an error. If I put quotes around it, it will literally look for the term @keyword anywhere in the body.

View 1 Replies View Related

Simple Search Query

Mar 16, 2007

Hi,

 

I'm writing
small search engine for my page. I need SQL query that could do this:

 

Source:

 

tblColours

------------

Red

GreenRed

White Red

Yellow

Blue Green

Yellow RedF

 

Search
string: Red

 

Required
results:

 

Red

White Red

Yellow RedF

 

As you can
see I need all occurrences of word Red and word Red* but I don’t need *Red or
*Red* so I can't use LIKE %Red% :(.

 

P.S. Sorry
for my English.

Fizikas.

View 1 Replies View Related

Simple Search Page

Feb 1, 2008

 Hello all, I am trying to build a simple search page using SQL Server 2005, Visual Web Developer in C#.I have enabled Full-Text Search on my DB and created the catalogs and indexes, but I am lost on the next step to build a search form that calls the data based on the users input in a textbox. Any suggestions? Thanks!Travis 

View 3 Replies View Related

Implementing A Simple Search

Mar 26, 2008

I'm not trying to do anything too fancy; given a string, I just wanna see if anything in the column of my database matches the string.  I'm using an SQL query that takes a string, then selects the data using LIKE %searchword%.This works fine when the user enters only one word.  But I guess you can see that a problem arises when they enter more than one word.So how can I implement a very simple search that will take more than one word? 

View 5 Replies View Related

Help Simple Search Date

Mar 28, 2008

hello I have this code Select Waste.WasteName AS [Waste Name], InvoiceDetail.Volume, Branch.BranchLocation AS [Branch Location] From InvoiceHeader INNER JOIN InvoiceDetail ON InvoiceHeader.InvoiceNo = InvoiceDetail.InvoiceNo INNER JOIN Waste ON InvoiceDetail.WasteID = Waste.WasteID INNER JOIN Branch ON InvoiceDetail.BranchID = Branch.BranchID Where WasteName = 'Sludge' AND InvoiceDate >= '" + TextBox1.Text + "' AND InvoiceDate <= '" + TextBox2.Text +  "'; The problem is everytime I will search for example InvoiceDate 03/27/2008, I need to add one day for example --> 03/28/2008 for me to be  able to get that Invoicedate 03/27/2008.. What's do you think is the problem with my code?  Thanks!  

View 9 Replies View Related

Wildcard In Simple Sql Search.

Mar 30, 2005

I'm very new to SQL so please forgive my ignorance...
I've made a simple .net search page which queries an sql database with the following query, (in a stored procedure):
SELECT     Category, Number, RegisteredUser, DeptName, Surname, Forename, Site, IDFROM         tblTelephonesWHERE     (@surname IS NULL OR                      Surname LIKE @surname) AND (@site IS NULL OR                      Site = @site) AND (@deptname IS NULL OR                      DeptName LIKE @deptname)
This works fine, as expected if i leave fields null or enter an exact match, but I (of course) have to add a wildcard in my search string for a wildcard search. For example, looking for 'duncan' i need to enter 'du%' or 'duncan'.
What I really want is for all searches to have wildcards behind them so only the first few characters need be inputted, and I could just search for 'd' or 'dun' without adding the '%' to get 'duncan'. I think I am aware of the implications of this approach and do want to go ahead as there are only about 850 records.
Any help or links to useful articles would really be greatly appreciated.

View 1 Replies View Related

My First ASP.NET (simple) Search Page For SQL

Mar 30, 2005

This question probably applies to Visual Web Developer but I don't know if it belongs in this Forum or that, sorry if you have to move it.
Hi there kind person reading this
I've created a stored procedure in SQL2000 that selects records where (name = @name) AND (site = @site). It works as I have tested it with Enterprise Manager.
I have also created a page with VWD that has a drop-down list populated with the site records and a text box. I have put an SQL data source on the page that is configured to select from the stored procedure. However, I can't set the @name and @site variables to collect from the ddl and txtbox through the wizard! I've tried selecting a Control as the source for @site but neither the ddl or txtbox appear in the control dropdown list. So  I want to crack it with handwritten code.
Does anyone know of a post or article that can help me link the ddl and txtbox to a search button, which calls the stored procedure with the chosen variables allowing me to put the returned data into a gridview? I've been through a great walkthrough for VWD (Student Activities) but it doesn't seem to apply to the latest version - or there's something wrong with my (seems fine though) instalation. Thanks if you can help, I owe you a

View 3 Replies View Related

Problems With A Simple Search

Apr 15, 2008

I have a table of news articles:


-------------------------------------
Articles
-------------------------------------
ID | Headline | Article
-------------------------------------


I'm trying to write a search function that will search through the text in the Article column. Here's my stored procedure:


ALTER PROCEDURE sproc_SearchNews
(
@keyword varchar(50)
)
AS
SELECTID, Headline, Article
FROMArticles
WHEREArticle LIKE '%' + REPLACE(@keyword, '%20', '%') + '%'
RETURN


There's a few problems with this however...
1. If I enter "Dog" into the search, it will skip over the article if it contains "dog". I need to convert the search term and the article text to lowercase.
2. If I enter "iron" into the search, it will find articles containing "iron", but it will also find articles containing "environment". How can I fix that without affecting my multiple word search in the WHERE clause?

View 3 Replies View Related

I Need A Simple Search Query

Jan 13, 2008

I have a table that has these columns:

LinkID, LinkURL, TimesRedirected

I have a webpage that keeps track of the url's of where the users are coming from. When they redirect to the page, the page will:

If the url of the previous page isn't in the database, add it
Otherwise, add to the TimesRedirected column.

View 6 Replies View Related

Simple Search Engine (windows Application)

Sep 14, 2005

I'd like to build a simple search engine against Sql Server. Does .NET Framework provide some class to help in this task? From what I've heard there is an interface which implements it..

View 1 Replies View Related

Query To Search All Fields In Simple Table

Mar 1, 2006

I am trying to write a simple search page that will search all the fields in a database to find all records that match a user input string.  The string could happen anywhere in any of the fields.  I have a dataset and can write a query but am unsure what the format is for this simple task. I figured it would look like this:
 
SELECT Table.*
FROM Table
WHERE * = @USERINPUT 
But thats not working.  Can someone help.?  Thanks..

View 1 Replies View Related

Can Anyone Write A Simple Query To Search For NULLs

Apr 30, 2008



Hello ALl, can anyone please tell me how to search for NULLS.

like i know one method....

select * from table
where col = 'NULL'

View 1 Replies View Related

Simple Text Processing E.g. Regex Search And Replace

Aug 8, 2006

I've got an nvarchar(max) column that I need to transform with some simple text processing: insert some markup at the very beginning, and insert some markup just before a particular regular expression is matched (or at the end, if no match is found).

Since the SSIS expression language doesn't support anything like this, is a Script Component the only way to go? Does Visual Basic .NET provide regular expression matching?

Thanks!

View 13 Replies View Related

Simple Function For Returning A Character Based On Search Criteria..

Feb 20, 2007

Hi,how do I do a simple formula, which will search a field for specialcharacters and return a value.If it finds "%" - it returns 1elseIf it finds "?" it returns 2endIf this is the incorrect newsgroups, please direct me to the correct oneregards Jorgen

View 2 Replies View Related

How To Search A Database For A Key Word Based Search?

Mar 1, 2007

Can anyone tell me how to search an SQL database for a given key word in a textbox? I basically have a database that has a qualifications column and this column needs to be searched for the data given in the textbox. Which is the best method to search for the data? Is it a simple SQL query or an XML based search engine type? Can anyone give any suggestions regarding this? If XML is efficient then how do I use it to query my database, as I'm pretty new in XML based searching.Thanks 

View 5 Replies View Related

How To Make A Search Engine To Search My Database

Nov 22, 2007

hi there,
 i am doing a school project and i need to have this search engine that will search the data that i have stored inside the database and display the results out
can anyone help?
thanks

View 6 Replies View Related

Cant Create New Database / CREATE DATABASE Permission Denied In Database Master (error 262)

Oct 2, 2007

 
 I am using SQL express and Visual web developer on windows Vista.
When I try to create a new database the following message appears.
 
CREATE DATABASE permission denied in database master (error 262)
I log on to my computer as an administrator.
Help appreciated
 Prontonet
 
 
 

View 4 Replies View Related

Create A Simple Table

Feb 6, 2008

i realize this is a basic question, but i'd like advise on the best way to create a table to store financial time series data. i already have a table to store securityid which is the primary key. However, when i move over to the table to store time series, i will have many secid as well as different dates and types of data. what should my primary key-autonumbered or concatenated from secid and date etc...in addition, i want to have a good way to query the table to make sure there are no dupes (same secid and same data etc). many thanks

View 1 Replies View Related

Create To Simple Reports

Jun 25, 2007

Hey Everyone,



I am new to SQL 2005 and Reports. How can I create an automated weekly report for a database to show Disk usage and top 10 tables. I am after to something similar to the Summary report in SQL 2005. Advantage would be to have it email as well.



Cheers,



Mark Bayliss

View 2 Replies View Related

Create Trigger (simple Question)

Feb 12, 2004

Hi,

I'm getting this error when I try to use "inserted" table in my create trigger call.

---------------------------
Microsoft Development Environment
---------------------------
ADO error: The column prefix 'inserted' does not match with a table name or alias name used in the query.


---------------------------
OK Help
---------------------------


Could you please, help me?

Thanks,
Rovshan

View 2 Replies View Related

Create Trigger (simple Question)

Feb 12, 2004

Hi,

I'm getting this error when I try to use "inserted" table in my create trigger call.

---------------------------
Microsoft Development Environment
---------------------------
ADO error: The column prefix 'inserted' does not match with a table name or alias name used in the query.


---------------------------
OK Help
---------------------------


Could you please, help me?

Thanks,
Rovshan

View 2 Replies View Related

How To Create Simple Insert Trigger

Oct 31, 2006

I have just one table but need to create a trigger that takes place after an update on the Orders table. I need it to multiply two columns and populate the 3rd column (total cost) with the result as so:

Orders
---------

ProductPrice ProductQuantity TotalCost
-------------- ------------------ -----------
£2.50 2
£1.75 3
£12.99 2


Can anyone please help me?

View 3 Replies View Related

How To Create A Search Query

Apr 14, 2008

Code Snippet

CREATE PROCEDURE GetSearchResults
@ParameterValue @varchar(max)
--WITH ENCRYPTION
as
select *
from OPS_Projects
select *
from OPS_Clients

go






I have this stored procedure that has one Parameter ....that parameter value will be a value that can be matched from eithier one of these tables but i am not sure how I need to write query...my logic I would like to read like this

Select * From OPS_Projects Where ThisData = ParameterValue

If this query returns data then, just return that data If not run next query

Select * From OPS_Project Where ThisOtherData = ParameterValue

If this query returns data then, just return that data If not run next query.... and so on....

Is this the best way to do to create a search query???? Any Help I am open for suggestions! Thanks!

View 8 Replies View Related

How Can I Automatic Create All That Objects In Assembly In Simple Way ??

Jan 12, 2006

Hi
 
I use SQL code snippet to attach the CLR assembly (dll) to the SQL Server Express
 
CREATE ASSEMBLY [DatabaseAndImages]
AUTHORIZATION [dbo]
FROM 'C:CLR_File.dll'
WITH PERMISSION_SET = SAFE
 
That file content CRL Codes for 10 Stored Procedures & 3 UDT & 5 Functions & 6 Triggers
As you can see it's content large amount of DB objects !!
 
My Question is ..
Is there any simple way can I use it to extract or automatic create all that Objects in the Database without use separate SQL Statement for each one ??
 
By Example , I will use this SQL statement to create the sp_AddImage that already located inside the CLR dll file
 
CREATE PROCEDURE [dbo].[sp_AddImage]
       @ImageID [uniqueidentifier],
       @ImageFileName [nvarchar](max),
       @Image [varbinary](max)
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [DatabaseAndImages].[StoredProcedures].[sp_AddImage]
 
 
But as you know .. I have many objects .. and I am in development phase and I will do change to that object many time and also may I will add much more €¦
 
I thing it's not good to write SQL Statement for each object and do changes every time when I change the object definition
 
Is there any one line of SQL statement can I use it to automatically create and extract all the objects inside the assembly ??
Or is there any way to do that Issue by simple operation ??
 
 
And thanks with my best regarding
Fraas

View 3 Replies View Related

How 2 Create An Effective Search On NTEXT ?

Nov 25, 2003

Dear SQL,

since I create some multi-language table - I want to allow finding unicode text
so I made the field: Key_Words" (ntext)

It will have a string that can include some words in different languages, so that I can find by using:
SELECT Key_Words FROM MyTable WHERE Key_Words LIKE '%" & MyVar & "%' "...

The problem is that I can not apply clustered index on ntext field (or *any* index...)

Any ideas how to deal with it ?

View 2 Replies View Related

How To Create A Full Text Search In DB.

Dec 29, 2005

Hi everibody.
My name is Ivan and I am from Slovakia.
I would like to ask you all for helping me in creating a full text search in database.
I am working in Visual Web Developer 2005.
I have a simple table in wich i have this atributes: ID, NAME, DESCRIPTION, CONTENT
I would like to use the search for this:
When I write down for example a NAME to a textarea (whatever else it can be), I need to get back the information about the ID of the apropriate NAME.
I would really appreciate your help here.
Please can you send me a mail with the solution or any help on ivoporsche@szm.sk
Thank you very much in advance.
 
 

View 1 Replies View Related

Simple Query To Create Column Of Sequential Numbers

May 2, 2006

Hi,
Can anyone tell me offhand the simplest/most elegant way of updating an integer column to a sequential column of numbers with a query?

e.g given

intval | Description| Cost
0 | Descvalue0| 4.32
2 | Descvalue2| 4.33
3 | Descvalue3| 4.34
8 | Descvalue8| 4.35

change it to:

intval | Description| Cost
0 | Descvalue0| 4.32
1 | Descvalue2| 4.33
2 | Descvalue3| 4.34
3 | Descvalue8| 4.35

I think it might need a stored proc..

Many Thanks
greg

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved