SQL Server :: Search Criteria For Multiple Columns?

Nov 18, 2010 12:46 PM

im trying to write a query. for my ui ,i have 3 text boxes for firstname,flightno,sequencenumber.

i input search value on particular textbox it has to be searched on particular column of my db in a single stored procedure.

im using this procedure but it retrives only one column at atime. so like this i need to write three procedures.

but i have only one GO button.

ALTER PROCEDURE [dbo].[spp_searchUsers3]
@lastname nvarchar(50),
@Value varchar(50)
DECLARE @SQL nvarchar(500)
SET @SQL = 'SELECT firstname,flightnumber,lastname,status FROM tbl_pregister WHERE '
+ @lastname + ' LIKE ''%' + @Value + '%'''


C# - LINQ To Entity Framwework Multiple Joins With Multiple Dynamic Search Criteria?

Jul 2 10 at 17:20

The gist of the problem is that we have an alumni table (one record per person) and also a couple of other tables (one to many) that have degree info and interest info. In a search screen in our app you can search for criteria that spans all three tables (there are actually more fields and tables than shown in the example below but I am trying to keep it simple).

The code below works (properly returns people without degrees for example) but still feels a little clunky or over-engineered to me. Are there easier ways to do this? NOTE: I have been through quite a few iterations/approaches to making the correct data be returned.


View 1 Replies View Related

Keywords Search Results From Multiple Columns Using C# With SQL Server?

Mar 26, 2009 05:31 AM

We are maintaining the profile information's (like profile first name, last name, address, city, state, age, religion, occupation, education, etc....) from tbl_profie table.
The users can search profiles using any keywords like

Example 1: MBBS, Delhi, India
Example 2: MBA, Delhi, cricket
Example 3 : London, Hindu

Tbl_profile table defending some parent table like Tbl_city, Tbl_state, Tbl_country, Tbl_occupation, Tbl_education tables, etc.So how to fetch user search results from Tbl_profile and profiles related tables using user's keyword with easiest way.

View 2 Replies View Related

SQL Server :: Search Multiple Columns Of Different Datatypes From 1 Parameter?

Nov 11, 2010 06:18 PM

We have 2 tables that i need to search thru..we are trying to be as flexible as possible with this search page.. a very stripped down version of how search engines are setup..

You have 1 textbox and are free to enter what ever you want..

Well in our case.. we want to setup a textbox on the page.. and pass that into our procedure and have it look thru 5 differnet columns ( id, date, name, time, number )

So if i enter say 1974 into the field, i want to go find any record that contains that in any of the 5 columns..

Is this possible without using SQL Full text indexing??

View 7 Replies View Related

Forms Data Controls :: Multiple Search Criteria ListView?

Jul 17, 2010 02:01 AM

search form!Have no idea how to do it.Hope the example says much about how it should operate!Profile search where the result will come out in a list view.theusers should be able to filter between firstname, lastname, age, gender.right now I have this!Search page


Search result page



View 11 Replies View Related

SQL Server :: Random Select With Multiple Criteria?

Dec 29, 2010 05:38 AM

I am working on a project for a market research company that needs to select and have it displayed to my gridview. I need a select statement that will randomly put on my gridview the following:

Recruitment Goal 21 people and out of those people 10 people have to be male, 11 people female, 9 of them white, 9 of them black, 2 of them hispanic. Is there a way I could do that? I was thinking of doing a stored procedure and doing something like

Select TOP 10 * from Canidates where sex = 'Male' order by newid() Into #tmp
Select TOP 11 * from Canidates where sex = 'Female' order by newid() Into #tmp
Etc... and then just selecting from the Temp Table.

View 10 Replies View Related

Go Back To A Search Page Without Losing Search Criteria?

2 days ago

It is about ASP.NET MVC3. I have a page with at the top some search criteria and at the bottom the resulting data. The user can type some criteria and use a submit button to retieve data. In my controller, I have an ActionResult function for managing these criteria and return to the same page with a ViewModel class filled.

The problem: the user can click on a line in the resulting table for viewing a detail page. On the detail page, he can navigate to an edit page for editing data. On this page (edit data) I would like to able the user to go back to the search result page (in fact: navigate back two times). What is the best way to proceed? If I "simply" use an ActionLink (without posting data) to my search result page, it will simply display an empty result page with empty search criteria. Maybe I need to keep my search criteria in a session variable? I don't like this kind of thing...

View 1 Replies View Related

Using Advanced Search Criteria

Dec 09, 2009 08:23 AM

I hope this is the right place for this post. I have developed an ASP.NET Application for Simple Workflow Process to Submit Leave Forms and Store them on a Folder in the Server using PDF Forms (Adobe LiveCycle Desinger 8.2). Now the users wants to track what forms which have been submitted, and the status of the forms: Staff ID, Submission Date, Approved, Pending Approval ...etc. problem is that I did not store such info in a Database, cause I was under huge pressure to deliver

. All such info are coded in the PDF Folder/File Name and the Date/Time is the Date/Time the file was modified

For example, if the folder name is "Pending Approval", this means it is Pending Approval, and if the Folder Name is "Approved" means it is approved, and if the PDF File Name/Path is "...ApprovedLeaveForm-20090101-123456.pdf" this means it is the leave form for Staff ID"123456" with Leave Start Date as Jan, 01, 2009. The status of this Leave Form is picked up from the Folder Name of this PDF File, so the status is "Approved". All such files are accessable via HTTP Link cause they are hosted in Web Folders under IIS on Windows Server 2003 R2. Also, the ASP.NET Web application is on the same server. ow, after 3 years, I have thousands of PDF files to be tracked, and I need to develop a function to track such files. I want to develop a Grid-Like View with a filter as follows, to query and track such PDF Files:

ASP/NET Page Title: Track Leave Forms
View Filter:
Staff ID From: XXXXXX
Leave Start Date Between: dd/mm/yyyy and dd/mm/yyyy
Status: * All | * Pending Approval | * Approved.
Grid View Result: Table listing with the following fields:

1. Staff ID,
2. Start Date,
3. Status,
4. Submitted Date/Time (Date File Modified),
5. URL Link to open the File.

I can use .NET System IO APIs to query such PDF Files, but I can imagine that it will be very slow. So, this lead me to investigate Indexing the Folders where the PDF Files are stored. I found the I can enbale IIS Indexing Services, and I can connect to it from ASP.NET using OLEDB like connection string. Basically, I want to Index the PDF Files under the designated folders on the Server, and I want to use the appropriate method to query such folders using the above filter, and get the results in a relatively short period.

View 2 Replies View Related

Set The Colour Of The Columns Based On Criteria?

Mar 08, 2010 06:29 PM

Duplicated post

View 1 Replies View Related

XML :: Search / Depending On Criteria Given In Dropdownlist?

Sep 30, 2009 07:43 AM

I'm quite new to asp.net and xml.

I have a problem here which is i need to search through the xml depending on the criteria given in a dropdownlist.

View 3 Replies View Related

Web Forms :: Can Change Search Criteria By Category

Sep 27, 2009 08:50 PM

i have many categories in my site. When a user select a category from categories i want to display search criteria about that category. When changed category, search critererias must change. How can i do this?

View 3 Replies View Related

Web Forms :: Unable To Add New Dropdownlist In Search Criteria

May 16, 2010 06:09 PM

I have this webform with few fieldsin the search criteria,I added a new dropdownlist named "Company",I populated it with the data from the database, now when I click search choosing this criteria it doent work.

public partial class List : PrintablePage
private string CNUM;
private string CNAM;
private string CEL;
private string SD;
private string SDE;........

View 14 Replies View Related

MVC :: Keeping A User's Search Criteria Saved?

Feb 14, 2011 02:09 PM

What is the best approach for keeping a user's search criteria saved in case they navigate back to the search page in MVC 2?

I was thinking of ViewData or creating a model that would keep that type of data.

View 2 Replies View Related

SQL Server :: Search Word In All Tables / Columns Of Database

Sep 15, 2010 09:49 PM

I am developing the Home page of a Client. Apart from various things on this home page I have a text box and search button. Having said that, I have a database in which I have almost 12 tables with varying number of columns. Now my question is,Is there anyway to search a word typed by a user in the textbox to search it in all the tables(all columns) of the database.

View 2 Replies View Related

SQL Server :: Search A Word In All The Columns Of A Single Table?

Sep 17, 2010 10:22 AM

How can I search a word in all the columns of a table?

View 4 Replies View Related

Forms Data Controls :: How To Preserver Search Criteria At PageIndexChanged

Nov 21, 2009 06:54 AM

I have a gridview grdMain with datasource id srcMain with selectedCommand "Select * from table1". I have one button btnSearch, at click the query changes to "Select * from table1 where name like 'roman' ".

This returns me 100 records out of total 10,000 records. But when I click on page 2 of gridview, the search criteria is gone. And I will see all 10,000 records again.

How can I control this problem.

View 5 Replies View Related

Web Forms :: Setup To Capture Search Criteria And Present To User?

Sep 08, 2010 03:53 PM

Requirements call for the ability to save search values so that they can select them at later times to return the results without having to re-enter the values. They have the ability to search on 4 different types of data (Date, Time and Lat/Long), so they would like to capture what was entered and ONLY if they chose to save those values, it will be saved and next time they login, if they are searching, they can pick an old search and submit it again.

Im thinking that i add a checkbox next to each button, if they check it, it saves the data into a table with there values and username. Next time they login and go tothe search page, if there are any records for them in the table, i present them with a link that displays all the values stored and if they select one, it will run the search again and present them with the results. does that sound like the right way to handle this request?

View 6 Replies View Related

Forms Data Controls :: Building Gridview With Text Search Criteria?

Mar 13, 2010 04:03 PM

I have gridview that I am filling with records from SQL database. However, I want to populate the gridview with records that match text search criteria. In other words, I want to be able to key in a word like "network" in a text box, pick up the text, read records and pick up on the records that match that criteria. I am doing fine with building the gridview but I am a bit new to this and I don't know what I do to do text search.

View 3 Replies View Related

DataSource Controls :: Multible Search Criteria With Empty Field Option?

Sep 08, 2010 11:51 AM

I have a gridview with two textboxes (first name & last name) and a linkbutton to search results inside the gridview.

I have made select parameters as well and the search works if i write in both textboxes. However, if I leave one textbox blank, i don't get any results.


How can I get results from searching only one textbox?

View 4 Replies View Related

Sql Server - Gridview Highlight Max Values In Multiple Columns?

Mar 29 at 19:53

I have a gridview that shows, for example, a baseball team's statistics. It's a standard sports stats grid - the rows show statistics for each player and the columns show the specific stat for the each player.

Easy enough so far. But what I would then like to do is style (highlight or bold) the Max or Min (the team leader) of each stat column. For example, Player A may only lead in one or two categories, so we cannot style the entire row. If Player A just leads the team in strikeouts, I just want to style the number of strikeouts he had (THAT cell only).

What's the best way to handle this? Make SQL Server do all the work and in effect, rank EVERY stat of each player, effectively doubling the number of columns (e.g. col: AB, col: ABRank). Or do I let the rowdatabound event of the gridview handle this?

If I chose the latter, I think I would get the Max of every statistical category from the datatable before binding (e.g. store them in a local variable) then on rowdatabound, if they match the value, apply the style.

View 3 Replies View Related

SQL Server :: Copy Data From Multiple Columns Into One Column?

Aug 26, 2010 03:03 PM

My View has four columns with years, none of the rows have complete yearly data.

Current View

Columns 1-10, FY, Expr1, Expr2, Expr3
Some data, 2010 NULL,NULL, NULL
Some data, NULL, 2010, NULL, NULL
Some data, NULL, NULL, 2010, NULL
Some data, NULL, 2010, 2010, 2010
Some data, 2010, NULL, 2010, 2010,
Some data, NULL, NULL, 2010, NULL
Some data, 2010, 2010, NULL, 2010
Some data, NULL, NULL, NULL, 2010

A new column needs to relfect 2010 for each row in the View.

Goal New View
Columns 1-10, FY_NEW
Some data, 2010
Some data, 2010
Some data, 2010, etc. for each row in the view

I can not hard code the data as time moves forward next year rows will have 2012, etc.

How can I get lthe year, in this case 2010, into a new column regardless of the year?

View 10 Replies View Related

DataSource Controls :: Searching Table With Multiple Criteria?

Apr 15, 2010 11:17 PM

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:


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 View Related

SQL Server :: Search Multiple Tables Via Stored Procedure?

Jul 27, 2010 01:34 PM

I'm a novice in .NET programming. I was trying to figure a way to make a MULTI TABLE search via a stored procedure for my website. I've written a SP to select records from one table, which isn't working for some unknown reasons:


Whatever I search for, the datagrid is displaying all records from my table.

View 5 Replies View Related

Web Forms :: If The User Doesnot Select Any Of The Above Three Then A Message Gets Displayed As "Please Select One Search Criteria?

Mar 02, 2011 09:14 PM

Can any one let me know about the below issue. I have a page which has three labels, say startdate,enddate and username. My issue is if the user doesnot select any of the above three then a message gets displayed as "Please select one search criteria" or if the user doesnot enter the date in correct format then i dispaly "Please enter date in mm/dd/yy" format. But what is happening is first time if the user doesnot select any then "Please select one search criteria" is getting displayed and after this message gets displayed if the user enters wrong format of date then both the messages are displayed.

View 5 Replies View Related

DataSource Controls :: Joining Multiple Tables Using Linq To Sql With A Number Of Criteria?

Dec 18, 2009 11:14 AM

I am using linq to sql and I need to apply some criteria to filter the record from two tables. One table is Staff and Second is Organisation. Staff contains OrgID, MemberSettingID, Values, ModifiedDate (OrgID and MemberSettingID both make composite primary key of table). Org contains OrgID, Name, AlsoKnown as. (OrgID is PK) so there can be multiple OrgID in Staff table.

Now I need to join the two tables such that I can get OrgID, Name and ModifiedDate, but the data should not repeat. i.e. only unique data should return against ORGID. And also the ModifiedDate must be Max() which should be latest modified date. it is something like that if staff table has following values

OrgID(PK) MemberSettingID ModifiedDate

1 1 10/10/2009 (dd/MM/yyyy)

1 2 12/12/2009

2 1 11/9/2009

2 2 3/11/2009

And Organisation table has following :

OrgID(PK) Name AlsoKnowAs



Now joining two tables must return the following data

OrgID(PK) Name ModifiedDate

1 2 12/12/2009

2 2 3/11/2009

I have to resolve this using linq to sql. No stored procedure, no database query.

what I am trying to do is here:

datacontext.AutoUpdate_StaffingStaffMemebers.OrderBy("ModifedDate")Distinct(datacontext.AutoUpdate_StaffingStaffMemebers.Select(w => w.PersonOrganisationID);

but I m feeling this is logically not true; moreover this is throwing a compile time error.

View 1 Replies View Related

Forms Data Controls :: Filter Gridview Based On Multiple Criteria Including Date Range?

Oct 21, 2009 07:03 PM

I'll start out by saying that I know just enough asp.net to be dangerous and not enough vb.net to pull off what I'm trying to do. So here it is:

I've spent way too much time trying to figure out how to return data to a control that is filtered based on customer, date range, and total monthly sales. I'm using vb.net. Here is the criteria for my report:

1. Page_load returns data that defaults to "all customers" in (preferably) a dropdownlist.

2. Page_load should also populate a "start date" dropdownlist and an "end date" dropdownlist that returns the earliest month (start date) and the most recent month (end date) as the defaults for the "all customers" default in other ddl.

3. Based on the above criteria, the Gridview (or whatever other control makes sense) should default to showing 2 columns - a "Year-Month" column and a "Total" column.

4. The user should then be able to use the 3 dropdownlists to filter the existing gridview data by selecting a customer, a start date for the Year-Month column, and an end date for the Year-Month column.

5. Upon selection of a new customer from the customer ddl the date ddls should maintain their state.

6. In addition to the gridview, the report should also have a chart. I'm using the Microsoft Chart control for that.

I've tried so many different approaches that I can't even keep them straight. I've used just sqldatasources, I've created a DAL and a BLL and used Objectdatasources, I've tried to handle filtering through sub select statements, I've attempted to integrate Crystal Reports. I even found what looked like my salvation - using an Ajax control to filter the columns. The problem with using the Ajax control is that it won't update my accompanying chart (at least I don't think that it is capable of doing that).

I should also mention that I'm using a SQL Server view that contains all the data that I'm querying. It creates a column that combines the year and the month data. It's in a string format that looks like "2009- 10". I did this for formatting purposes.

View 5 Replies View Related

SQL Server :: Data Type Mismatch In Criteria Expression: Date

Oct 04, 2010 07:13 PM

I am getting a "Data type mismatch in criteria expression" error when trying the following SELECT statement. strdt and spdate are Date types in my vb codebehind and the Contract field name is a DateTime field.

nmxSQL As
String =
"SELECT * FROM Nymex WHERE (NymexID='" & nymID &
"' And Contract>='" & strdt &
"' And Contract<='" & spdate &

View 4 Replies View Related

DataSource Controls :: Search By First Merging The Columns Data?

Jan 16, 2010 12:45 PM

I Have a table containing columns Address1,Address2,Address3,State,City and Area.Now i want to apply search Location where there will be a single textbox where the user can enter multiple strings seperated by spaces and then those rows should be fetched which contains all these strings entered by the user (implementing AND Case). For which the search on rows should be applied by merging the data of all the above mentioned columns and then searched.How to implement the above case?

View 12 Replies View Related

DataSource Controls :: Word Search In Sql Server Without Full Text Search On Particular Column?

Jan 27, 2010 10:05 AM

I want a word search i doing the search like this , but it is giving character wherever there is in the string,if i give two character like ok it is searching for a full string where ever Ok is there select * from table1 where textfield like '%word%' this query would match word but also wordabc how can i make it aware of delimitions

View 3 Replies View Related

SQL Server :: Minimum Search Engine - Add A Search Mechanism To The Site

Jan 19, 2011 06:29 PM

I have a database filled with information about a bunch of different articles. I'm trying to add a search mechanisim to the site where you would type in what you are looking for, and it would search through the articles finding the most appropriate article. In my database I have a bunch of different fields that will help find the best article. For example, for each article, there is a title, description, category, a bunch of tags, Number of page views, number of votes, and the sum of all the vote scores. All this informaiton i believe can be used to gather the most relevent article based on the persons search terms. The problem is I don't know what to do with this information. What I would like to do is have a scoring system where the highest score is the first result and the lowest score is the last result. Where the first result is the most relevent.

So for example: The user types in "Korean War" it looks through all the articles, and gives all the articles with "Korean War" in the title + 1, all the tags with "Korean" or "War" + .1, then adds the number of views/1000, and then adds the average vote/4. (I just made that scoring system up on the spot, I would need to do some testing of course). Then it would sort the articles based upon the score it recieved. Is there anyway to do this with a select statement where I can run all of the calculations and then sort them with an "ORDER BY" command? Or would i have to have the server side code do the calculations store them in an array, and then sort them in the array? Or is there a better way of doing this that I might not know of (which is certainly possible).

View 3 Replies View Related

Linq To Sql - 4.0 Dynamic Data Generating Search Or Filtering For Each Columns?

Aug 3 10 at 3:09

I am using dynamic data entities linq to sql project. For my test project I have one table, with 10 columns and a single primary key for example. Almost all the columns are varchars.I can get the basic project up and running fine - update, delete, insert etc.ince it has no foreign keys, there are no search filters rendered. I was wondering if there was an easy way to generate a set of filters for the columns for this table. So a First name and last name search box. Is there a way to generate these filters for chosen columns and is there a way to generate these for all the columns

for example, above each of the columns in the grid there might be a text box ( I am not too fussed where the text boxes are rendered as such). Each of the text boxes will act as a filter for that column (doing a SQL 'like')

View 1 Replies View Related

DataSource Controls :: Search Various Database Columns Based On User's Input?

Nov 18, 2010 03:31 PM

I have five textboxes(tb1, tb2, ... tb5) on the page, each textbox represent a column in the database table.

I need to search the database table based on the text in the textboxes. User can either enter text in all five textboxes or none.

What's the best way to do a search?

I am thinking for one textbox(tb1), depends on if tb1.text is empty or not, I need to do 2 searches


for two textboxes(tb1 & tb2), depends on if tb1.text and/or tb2.text are empty or not, there are 4 combinations, so I need to do 4 searches


for three textboxes, there are 8 combinations,

Does that mean for five textboxes, I need to do 2 to the power of 5, 32 combinations, 32 if statements?

View 1 Replies View Related

Search On Multiple DBs For Multiple Words?

Feb 08, 2011 04:47 PM

i have the following controls:


And the onclick method:


The Search.aspx has a SqlDataSource that get that querystring and search on 3 DBs for just 1 word. I was wondering how i could implement if i want to search for multiple words on that Textbox txtSearch. Could i use the SqlDataSource for that or should i use LINQ or another component ?

View 4 Replies View Related

DataSource Controls :: Multi Worded Full Text Index Search On 2 Columns?

Jan 12, 2011 01:35 AM

I am having with the a full text index I am developing for a product catalog. It does all work to a degree I am just seeing some strange things happening.

From the database side I have a Products table that is being indexed on both the PartNumber and Description columns because I would like the users to be able to search either or using the search function.

Problem 1:

whenever I use multiple words in the search I don't always get the results I am looking for, this happens most notably when I am attempting to say put in a full part number (which for in this case would look like "I 10-9.2")

Problem 2:

I am not 100% sure that this is the most efficient way of completing what I am attempting to accomplish here since I have 2 columns that I need to perform the search on

Here is an excerpt from the click even when the user clicks the search button on the page:


And here is the search functions called from the click event to firstly check if there are any results and the second to display the results in a custom gridview:


View 1 Replies View Related

DataSource Controls :: How To Parse Normal Search Text To Sql Server Full Text Search String

Feb 13, 2010 06:36 AM

How i can make the normal search string to sql server full text search parse, because when we are user enyer search text "how to run windows schedule in C#", in database we have article to to this, but data not returning and sometime is say error in key word and etc.

View 1 Replies View Related

C# - Multiple Search Boxes?

Apr 8 10 at 17:33

I have 6 text boxes on an asp page and one search button. Users can search by entering text in any of the search boxes. I am using Linq to query to my sql server database and I can write the queries. but the problem is since there are so many text boxes I will have to write lot of queries. for ex: user can search by entering data in all 6 text boxes or 5 text boxes or 4 or 3 or 2 or 1. You can see how many queries I have to write. Is there any way to code this kind of problem or should I just code all possible combinations.

View 1 Replies View Related

SQL Server :: How To Save Pdf Files In Database And Create A Search Engine To Search For Pdf Files

Sep 28, 2010 10:41 PM

in my project i would like to save pdf files in database, how to save pdf files in database ? along with that i would like to create create a search page to search for pdf files with PDF file names , how to accoplish these things

View 3 Replies View Related

Display Multiple Columns In Label?

Feb 24 09

i have created a label. i had a table(Empinfo) for Employee information in SQL server 2000 my Query ="Select Firstname,lastname from Empinfo" my connection ok! i get connected and display the values of both the columns in the datagridveiw its ok too and done My Problem But i want to display the both the column in that label..

View 12 Replies View Related

How To Count Records From Multiple Columns Using Sql

Jul 7 10 at 19:20

I have a table with 5 columns: ID, Session1, Session2, Session3, Session4. What I want to do is to display the number of same items from each column. Same item can't appear in more than one column.

ID Session1 Session2 Session3 Session4
-- -------- -------- -------- --------
1 Music Web Tech Future
2 Art Articles Search Introduction
3 Music Books Camera Phone
4 Music Glass Cup Future
5 Art Books Tech Future
6 Music Glass Cup Phone

I want to display it like this on an asp.net page.

Music: 4
Art: 2
Web: 1
Articles: 1
Books: 2
Glass: 2
Tech: 2
Search: 1
Camera: 1
Cup: 2
Future: 3
introduction: 1
Phone: 2

how would I construct a sql query and display them on asp.net?

View 3 Replies View Related

ADO.NET :: Linq On Multiple Tables With Same Columns

Aug 17, 2010 08:31 AM

I have a partitioned db where several tables have the exact same structure. I'm able to query the tables using linq, but only by quering the individual tables 1 at a time and by using the explicit table name. For example at the moment, I have 8 tables so I have something similar to the following:


Is there any way, that based on a certain value (stringValue), I could determine which table to query and then code the linq query just once?

View 2 Replies View Related

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