SQL Server :: Searching Table With Multiple Parameters?

Sep 16, 2010

I want to query an SQL table using some Web controls to provide the parameters for filtering the records in the table. Results are displayed in a GridView.

I have a TextBox with an ID of "keyword" where the user may enter one or more keywords. I'd like to search 2 columns for instances of these keywords.

I also have a DropDownList named "category" that lists categories contained in a "category" column of the table.

I have a dataset with a TableAdapter for the table I want to search. Got it working fine with the DropDown List but not sure how to proceed with the TextBox and keywords.

What SQL query should I use? The user may not enter anything into the textbox, they may enter one word, or multiple words.

This is where I am now:

SELECT * FROM tablename WHERE category = @category AND ??

View 7 Replies


Similar Messages:

SQL Server :: What If Multiple Output Parameters And Input Parameters And Also Want A Select Table

Feb 16, 2011

[Code]....

When I want to get the output values its okay but I also want returning a table as a result data.But Datareader has no rows.is it possible if I want a returning query result and multiple output values togather ?I wrote a test above.I can get output values as sqlparameters. But Datareader attached to a Gridview is empty.can you detect whats wrong here and it doesnt return a query result.So stored procedure is not standart or ı am doing something wrong.this doesnt raise any exception.but not returning any data.

[code]....

View 8 Replies

Web Forms :: Searching GridView Multiple Parameters

Jul 9, 2012

I have three text boxs

1.txtname
2.txtage
3.txtmobile

and one dropdownlist

1.ddlcity
for search client information.

My requirement is when search button click the client information will bind in gridview based on data filled in textbox and dropdown list. 

The difficulty is user can enter any combination for search. E.g.

1.age only
2.name and city
3.city only etc.

View 1 Replies

Multiple Methods Of Searching Same Sql Table?

Jan 26, 2010

First off I'm a week into asp so apologies in advance for silly questions! I am looking to connect to a SQL database table and allow the user to filter the table based on a search box on the asp page. I have written a sql query with a parameter in the where clause, a bit like this:

select col1, col2
from table
where col1 like @my_parameter

Then I pointed the parameter to a textbox on my asp page, and this seems to work quite well. However, I would now like to add an additional search facility which would be a dropdown list. This would be sourcing all the unique values from the col2 in my table abve (there are only about 10 possible values here). But I don't want users to be able to use both of these searches at the same time.

So the bottom line is I would like to offer two methods of filtering the same data table, which search on different columns of the data table. Then the results should populate the same results table, but the user must only be able to use one search method or the other.

I have done a bit of research but couldn't find anything along these lines (I think it is becuase I don't know the words of the things I should be searching for!). I did find information on a standard postback event or cross page posting - not sure which of these (if any) is the best to use for a beginner?

View 2 Replies

DataSource Controls :: Searching Table With Multiple Criteria?

Apr 15, 2010

I want to select data from a table where the user can search by 3 options; date, keyword, and type. The date will always be either today or a user chosen date. The keyword can be null or something the user inputs. The type will be chosen from a drop down and can be all or a specific category. I know how to search the date, but the other two create complications. I have created a stored procedure trying to figure this out:

[Code]....

Is there a way to say if the keyword is null then don't use it as a search criteria. If that is possible then type can use that same logic I suppose.

View 6 Replies

Searching In Multiple Tables Using MS SQL Server 2000?

Sep 14, 2010

We have a database with a lot of information about Persons. I won't post the entire database structure because it is too big, but it looks something like this:

Person
ID
Name
Street
City
State
Country
Language
LangCode
Language
Interest
ID
LastChangedBy
LastChangedOn
LocalizedInterest
InterestID
LangCode
Description
PersonInterest
PersonID
InterestID

Now, this is just a small example. In our database, we have about 8-9 localized tables (like Interest) a Person can be linked to. A Person can have multiple Interests, a Person can have multiple Jobs, a Person can have multiple Educations, a Person can have multiple Experiences, I have to build a search function. Let's say you enter "tom" as the search term. This should give a list of all Persons with "tom" in their Name, Street, City, State, Country, in one of their Interests, in one of their Jobs, in one of their Educations, in one of their Experiences or in one of the other linked tables.

If you enter multiple words to search for (eg. "tom php"), it should give a list of all Persons with "tom" in their Name, Street, City, State, Country, in one of their Interests, in one of their Jobs, in one of their Educations, in one of their Experiences or in one of the other linked tables AND "php" in their Name, Street, City, State, Country, in one of their Interests, in one of their Jobs, in one of their Educations, in one of their Experiences or in one of the other linked tables. At the moment there are about 4,500 records in the Person table and if I do an outer join of Person with all the tables I have to search, there are about 1,300,000 records and 40-50 fields to search in.

How should I approach this problem so that performance will be acceptable? The client expects "something like Google" in terms of speed and ease of use. We're using MS SQL Server 2000 and ASP.NET 2.0. The search functionality has to be added to an existing application and changing the technology or database structure is not an option.

View 1 Replies

DataSource Controls :: Filtering Data (searching) On Parameters (more Than 1 Parameter)

Feb 12, 2010

I want to make data-driven page and ability to filter data on some parameters, for example 3 text boxes and 2 dropdown lists and then show the results by the grid view control.

Actually I like input data in the text boxes and select item from dropdown list and then press "OK" Button and result (filtered data) show in the new page by the grid view.

What I have seen in the quick start tutorial is filtering by one parameter.

View 1 Replies

SQL Server :: Stored Procedure With Multiple Parameters?

Nov 28, 2010

I have a table with 4 columns.The first column is a list of teams.The other three columns specify whether the team member with the particular id is present on any particular day .Say for example in the third row the running Team has 2 and 3 which means team member with the id 2 and 3 are present.Multiple values are seperated by the pipe symbol '|'.I have a Query like this

Select Teamname from tblTeam where Running not like '%|2|%' and Running not like '%|3|%' and Running not like '%|7|%' and Biking not like '%|1|%' and Biking not like '%|4|%' and Biking not like '%|7|%' and shooting not like '%|3|%' and shooting not like '%|4|%' and shooting not like '%|7|%' Basically i am searching the columns with like clause.The search criteria for each column may vary.In the above query i am searching for Teams where Running column does not contain 2,3 and 7,Biking column does not contain 1,4 and 7 and the shooting column does not contain 3,4 and 7. I would like to set a stored procedure where i would be able to pass 3 set of parameters from the code behind(I am using VB.net) for Running column search,Biking column search and the shooting column search.

Can someone tell me writing a simple stored procedure.I have a table with 4 columns.The first column is list of teams.The other three columns specify whether the team member with the particular id is present or not on any particular day .Say for example in the third row the running column has 2 and 3 which means team member with the id 2 and 3 are present.Multiple values are seperated by the pipe symbol '|'.

View 13 Replies

ADO.NET :: Searching Through Multiple Tables (Linq To SQL)?

Aug 12, 2010

I have a couple tables that are kind of unrelated - id like to search through both of them and create a type that i can sift through later

something like this doesnt work

[Code]....

I basically want to create a list of "AnimalSearchResults" that contains all dogs and all cats that have that name Whats the best way to do something like this?

View 6 Replies

Multiple Text Boxes Used For Filtering/searching In MVC C#?

Jan 21, 2010

I am trying to create a form in MVC C# that will allow a user to input a Last Name, First Name, Department, Year and click a Search button that will bring back a list of employees based off the inputted search criteria.My problem is allowing multiple search textbox criteria into one search button. I am able to hardcode values into an html actionlink like below and it works but unable to grab the values from the textboxes.

<%= Html.ActionLink("Results", "Results", new { lastName = "Smith",
firstName = "", dept = "", year = "2008" } )%>

I would really just like to have four textboxes and a search button to bring the list back from the database.

View 3 Replies

MVC :: Application Pulling Out Seperate Links By Word By Searching Within Headline Table Row ?

Oct 31, 2010

I am having with placing an If statement to write a message of "please try again" if someones search query finds nothing within my headline table within my database.

I have got my application pulling out seperate links by word by searching within my headline table row but what I want is if there isn't a word associated from the users search to display the "please try again". The code I have in my controller and the view page is as follows :-

HOME CONTROLLER

using UniApp.Controllers;
using System.Linq;
using System.Web.Mvc;[code]....

View 4 Replies

SQL Server :: SUM In Multiple Queries Of Each Table

Dec 21, 2010

I want to find the sum of each tables fileld. how can do this. i tried the following.but could nt get the correct sum. "SELECT SUM(gb) FROM data20 union all SELECT SUM(gb) FROM data10 union all SELECT SUM(gb) FROM data5 union all SELECT SUM(gb) FROM data6"

View 7 Replies

SQL Server :: Best Way To Speed Up Searching?

Feb 1, 2011

I have a web application running on ASP.NET 3.5 which basically stores, retrieves, and allows users to manipulate data from a SQL Server 2005 database. One of the features allows users to search through the records in the database. When the system was first launched last year, there were no records, so searches were lightning fast. However, over the past year, about 100,000 records have been entered, so most searches now take over 15 seconds to perform. I'd like to speed up searches, but there are problems with both of the conventional approaches I can think of:

Caching - The database does all the heavy lifting in this application - the ASP.NET web application is little more than a UI that passes user input to the correct stored procedure, and displays the returned output. The stored procedures are responsible for interpreting user input, applying the business rules, and transforming the underlying tables and views into a context-sensitive result set which the application just displays as is. Unless if there's a way to apply a stored procedure to a C# object/collection (the cached records), and get another C# object/collection back, effectively bypassing the database, I don't think this will work.Stored procedure optimization - There's some optimization potential here, but even a simple SELECT * FROM TheView statement on the underlying view currently takes 11 seconds according to SSMS, and I expect that the amount of time taken will continue to increase as more records are entered.Are there are techniques out there that I'm not aware of, which could be used to bring searching down to a reasonable amount of time (5 seconds or less per search)?

View 4 Replies

SQL Server :: Table Cause Cycles Or Multiple Cascade Paths?

Oct 4, 2010

i have a table that contains 3 forign keys, 2 of them from the same table when i make Delete Rule Cascade,this error message appears

'Customers' table saved successfully
'Order' table
- Unable to create relationship 'FK_Order_Customers1'.

Introducing FOREIGN KEY constraint 'FK_Order_Customers1' on table 'Order' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint. See previous errors. what is solution,as i want when i delete data from master table ,all dependent (child) data automatically deleted, so i use Cascade.

View 2 Replies

SQL Server :: How To Concatenate Multiple Rows Of Single Table

Mar 8, 2011

I've a table where one person teaches multiple classes. It looks like this.

Table1

Id Name Class Subject
----------------------------------------
2 Sam 12 English
2 Sam 10 Maths
2 Sam 10 English
2 Sam 8 History
2 Sam 12 Economics

Here Sam teaches Class 12 - English & Economics, Class 10 - Maths & English, Class 8 - History

I want to display the result like this -

Id Name Class Subject
---------------------------------------------------------------
2 Sam 12 English, Economics
2 Sam 10 Maths, English
2 Sam 8 History

How to concatenate multiple Rows?

View 6 Replies

Create Multiple RadioButtonLists From A Single Table In SQL Server Using C#?

Nov 11, 2010

I would like to use ASP.net, C# and SQL to display a list of games with radio buttons like below (the x is the radio). One team can be selected for each game.

game 1: x team 4 x team 2
game 2: x team 6 x team 1
game 3: x team 5 x team 3

The game list is stored in a table in an SQL database. So far, I can pull all teams into one big RadioButtonList. I cannot figure out how to create multiple RadioButtonList controls from this single table of games. Does anyone know how this can be accomplished - or reference to an example / tutorial that accomplishes something like this?

View 1 Replies

SQL Server :: Full Text Searching Is Not Working?

Mar 23, 2011

suppose i have column values:

3
6
3,6
36
363
i want to display column which contain "6" means

6 and 3,6 not 36 and 363

so i am using full text search:

use PMS
go
EXEC sp_fulltext_database 'enable'
go
CREATE FULLTEXT CATALOG pmscatalog
go
CREATE FULLTEXT INDEX ON PMS.dbo.emp_project
(
empid
Language 0X0
)
KEY INDEX PK_emp_project ON pmscatalog
WITH CHANGE_TRACKING AUTO
SELECT empid
FROM emp_project
WHERE CONTAINS(empid, '"6"')

but it is not returning anything...

View 1 Replies

Web Forms :: How To Insert Multiple Record With Table In A Cell Into Sql Server

Mar 16, 2010

i need to call multi dropdown for products that retrieve product name from microsoft sql and get the price as the product is been selected from the dropdown for total amount for the customer.Example is for customer to buy 6 product.The client is to enter the number of product purchase and the 6 dropdown appears as he click ok button.And as the clients select the product from the dropdown the price sum up together before saving into database.

View 1 Replies

SQL Server :: Multiple Users Inserting Values In The Same Table At Same Time?

Dec 15, 2010

I have one SP in sql server which takes the data from user and inserts into three tables. My problem is if multiple users call the same SP in same time it throwing error..(I guess one user at a time can access the table and table will be locked, that is why remaning users getting error)how to handle this situation. it is a web application, so at a time so many people can call the same SP.How can many users insert data in the same table in the same time?

View 5 Replies

C# - Unable To Create A Multiple Row Table From Server Side Code?

Feb 22, 2010

I am trying to create a table dynamically in my code behind. My problem is I have a count of how many controls I want added to each TableRow after which I want to add that TableRow to the table and then start a new row. Here is the code I have no far but it just adds one row and does not move any of the controls to a seperate new row.

public void FillTable(string DB, int? appID, string function, int? rID, string UserId, int ControlsperRow)
{
OneEvaDataContext datacontext = new OneEvaDataContext();
var results = datacontext.sp_Build_Menu_Field_Names(DB, appID, function, rID);
int controlCount = 0;

[Code]....

I would have thought that doing the .Add only when I am finished building that row would work but I guess since I'm using the same TableRow "tr" It is only putting in just one row.

EDIT: in the is context base is my class which looks like this:

public class Dynamic_Search_Table : System.Web.UI.WebControls.Table
{

View 1 Replies

Web Forms :: How To Give Multiple Inner Joins To Single Table In SQL Server

Oct 30, 2012

how to give a multiple inner joins to the single table

View 1 Replies

Searching Server Software To Build A Multiplayer Online Game?

Mar 26, 2011

I was searching server software to build a Multiplayer Online Game. All of the servers I found up to now use Java in the server side (ie smartfoxserver)

Today I found this one, Photon, that seems interesting because it uses .NET, you can see it here:
www.exitgames.com

View 4 Replies

How To Move Stored Procedure From SQL Server 2000 To 2005, Multiple Table Insert

Jul 21, 2010

moving some tables & stored procedures from SQL Server 2000, to SQL Server 2005.So far so good, but I've come across a problem with this stored procedure:

CREATE PROCEDURE [dbo].[user_insert]
@user_service_unit int,
@user_champion_1 varchar(50),
@user_champion_1_nt varchar(10),
@user_champion_2 varchar(50),
@user_champion_2_nt varchar(10),
@user_champion_3 varchar(50),
@user_champion_3_nt varchar(10),
@user_date_received datetime,
@user_requestor varchar(255),
@user_info_requested text,
@user_expiry_date datetime,
@user_10_days datetime,
@user_5_days datetime,
@user_2_days datetime
[code]...

View 3 Replies

C# - Multiple POST Parameters, Some Containing XML?

Oct 20, 2010

I'd Like to be able to have my web service accept multiple POST parameters, some of which will be XML. Is this possible? The code below will generate a server error:

WebResponse resp = (WebResponse)req.GetResponse();
string programId = "1";
string statusMessages = statusMessagesXML.ToString(SaveOptions.DisableFormatting);

[code]...

View 1 Replies

C# - Selecting Multiple Table Values And Binding The Data Into Multiple Grids?

Oct 5, 2010

i have multiple tables .

I have created one stored procedure where I am selecting the table values.

like

[code]....

I am using LINQ to retrieve the Data. So Using Linq I am calling the stored procedure.

So I ll get the table values in the C# Code the table values.

so in my UI i have 4 gridviews.

I want split the output values into four source and bind it to the grid.

View 1 Replies







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