SQL Server :: Search Criteria For Multiple Columns?

Nov 18, 2010

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 + '%'''

View 4 Replies


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

Jul 2, 2010

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

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

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

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

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?

Apr 3, 2011

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 9, 2009

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 8, 2010

Duplicated post

View 1 Replies View Related

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

Sep 30, 2009

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

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

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

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

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

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

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 8, 2010

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

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 8, 2010

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, 2011

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

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

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

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 2, 2011

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

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

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 4, 2010

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

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

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

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

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