Query For Search Based On Fileds?
Jan 9, 2011i have 5 Text boxes , all are searching options like
[code]...
i have 5 Text boxes , all are searching options like
[code]...
This is my Table structure:-Table1
Field1 Field2 Age
Dean Chen 20
Janel Wast 25
ann Miller 20
I used this select statement
select Field1+' - '+Filed2 from Table1
and i binded this in dropdownlist
now on selecting dropdownlist i need to show age in label. so how would be my select statement... to show age base on Filed1 and Filed2
I have two text boxes for the user to enter UserName & First Name, both these fields are optional and not mandatory to fill.
once the user presses the Search button, i execute the following query to fetch matching records.
[Code]....
The problem is, in cases where User leaves both the textbox or one of the textbox empty/blank, in that case that particular field should be removed from where clause.
More like if something is entered then search for that particular record otherwise search for all the records.
i dont why its happening.Below is my table
Create table workorder
(
WoID nvarchar(10),
[code]...
I have 3 different work centers assigened to 3Text fileds on my webform DesignDate,CollectDate,TMSDate ).the process of job is likely to be DesignDate->CoolectDate->TMSDate.when i complete the Design process i will go for Coolect filed and put a date(which indicates particulr job due date)when i am moving from Current work center to nextwork center previous work center should be locked .is it possible to to do locking the textbox if already date exists in that field else allow to enter for text.My text fields are txtDD,txtCD,txtTMS.
View 3 RepliesI have a form with search which it contains more than 5 fileds to search.
No field is required, user can enter any one field to search.
Iam getting the data from more than 3 tables by joining.
I am basically looking to bind a search query to a gridview which is nice, but this must be done by a users input query (sort of like a search function). I can get single values and rows returned, but how would I get it to search all columns in my database for the inputted values and return it?
Void SearchFunction()
{
TiamoDataContext context = new TiamoDataContext();
var search from p in context.UserProfiles
where p.DanceType == UserSearchString
select p;
[code]...
In my webpage I have a textbox where the user can type information that they want to search by. I need to take the user input and build a sql query to return records. I have tested my query in sql and it works hardcoding parameters, however I am having trouble getting the user input dynamically and populating my query string. how to get the user input to populate my query string?
Here is my code:
[Code]....
In my applications need to seach files in particular directory based on modified date .i have to view in selected dates whats are files are modified in particular directory .
View 1 RepliesHow can i make proper search result for example if i have one article now it have different tag like my article is related to asp.net ..in that article i am adding some tag like asp.net, database.user will come and click on that tag and related article will be come for example user click on asp.net tag then al related article will be come.
View 1 RepliesI'm looking for something similar to EasyQuery. Some sort of control that lets the user or the admin to select some tables, then some columns for the tables and the conditions, so he can do the query without entering the mysql sentence, only selecting the tables and the rows...
View 1 Repliesi want to add add coulmn name in sql query at run time and if any field is blank or null than it should not goes with sql query for search ....
column name:
firstName.Text
lastName.Text
address.Text
SqlCommand cmd = new SqlCommand("select * from hotelreg where '" + firstName.Text + "' and '" + lastName.Text + "', and '" + address.Text + "' like '%"+textbox1.Text+"%'", con);
I am developing a web form for search capability. The search query should return records from three different tables. How to display these three table records in three different rows. The search query should get the results from Table 1 and Table 2. Table 2 and Table 3 has a parent child relation ship. Which controls can I use for this purpose?
View 5 RepliesI have a scenario where i want user to open a popup or other page from a web form to search contacts from database and add them to list and when done return that list back to parent form field and continue filling other fields.I have 2-3 user input which should take multiple values for each field from list of values and i wanted to implement this using pop up based search and add method (other alternative was to use dropdown with checkbox but the list is so big and it is not user friendly to use that)
Is this feasible using asp.net or is there a better architecture/method in .NET to implement this type other than popup based search and retrieval.
i want to get data from database using text box . when i enter id in text box it should fetch all the record related to that id ?
View 1 Repliesi am developing a web site in Asp.Net using Visual Studio 2008.i want to know that how can i search a keyword that will be entered by the user, i want the key word should be searched in complete database(all the tables)using a single query.I am using sql database. how can the keyword be searched using like parameter...
View 1 RepliesI have a Dictionary<string, bool> where key - control's ID and value - it's visible status to set:
var dic = new Dictionary<string, bool>
{
{ "rowFoo", true},
{ "rowBar", false },
...
};
Some of controls can be null, i.e. dic.ToDictionary(k => this.FindControl(k), v => v) will not work because key can't be null. I can do next:
dic
.Where(p => this.FindControl(p.Key) != null)
.ForEach(p => this.FindControl(p.Key).Visible = p.Value); // my own extension method
but this will call FindControl() twice for each key. How to avoid double search and select only those keys for which appropriate control exists? Something like:
var c= FindControl(p.Key);
if (c!= null)
return c;
but using LINQ.
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
[Code]....
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
[Code]....
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?
I want to display all the items existing in database for ex:
If i enter just book. All the items with book work should get displayed
Example in google search as soon as we enter one word related all things get displayed. I am not talking about auto completion
I want to be able to make a query from three dropdownlists but not all three have to be selected to create results. This is what I have so far :
sub getdata (src as object, e as eventargs)
dim strsql as string
dim myconnection as oledbconnection
dim mycommand as oledbcommand
myconnection = new oledbconnection(ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_csrdb"))
strsql ="SELECT tbl_case.Case_id, tbl_case.Title, tbl_case.Description, Tbl_Country.Country_Name, tbl_principle.Principle_Name," _
& "tbl_keyword.Keyword FROM tbl_keyword INNER JOIN ((tbl_principle INNER JOIN (Tbl_Country INNER JOIN tbl_case ON Tbl_Country.Country_Id
tbl_case.country) ON tbl_principle.Principle_ID = tbl_case.Principle) INNER JOIN tbl_Usedkeywords ON tbl_case.Case_id
= tbl_Usedkeywords.case) ON tbl_keyword.Keyword_id = tbl_Usedkeywords.keyword " _
& "WHERE "
if DLPrinciple.selectedindex=0 then
strsql = strsql & "((tbl_principle.Principle_Name) like '%')"
else
if DLCountry.Selectedindex=0 then
strsql = strsql & "((tbl_country.country_Name) like '%')"
else
if DLKeyword.selectedindex=0 then
strsql = strsql & "((tbl_keyword.Keyword) like '%')"
else
strsql = strsql & "((tbl_principle.principle_Name) = '" & session("infoprinciple") & "')" + "((tbl_country.country_Name) = '" & session("infoland") & "')" + "((tbl_keyword.keyword) = '" & session("infokeyword") & "')"
end if
end if
end if
This is working perfectly with only one dropdownlist but I can not figure out how to make it work with several.
I would like a site that offers the users the possibility to search over 2 datasources but as i tried to indicate in the subject title the searches are one after another where the result of search 1 is used as a parameter for searching the second datasource. The order of the search would depend for what you search (ideally). Some "fields" or "data" of course appear in both datasources.
To get more specific: datasource 1 contains chemical structures and the associated "id" for this structure + additonal properties. You can search for chemical structures here. (chemically intelligent system). datasource 2 contains documents which are indexed (full text) and have metadata fields one of them beeing above id. No chemical search possible.
The idea is now that i perform a search by chemical structure on datasource 1. As as a result I get a list of id's. These id's are then past into datasource 2 as parameter + also all additionaly parameters entered. There are API's available to perform above searches on the 2 datasources. Is this a reasonable approach? Would it be better to create somekind of a simple datawarehouse, eg a table with all numbers linked to all documents they appear in? (would't know how to achievie this actually since it's the 2 datasoruces are not the same rdbms).
I'm developing an ASP.NET application which has allows users to search for other users based on their name. This search is done using Linq to SQL. At the moment, I've only got 10 or so users in my database, so I can't really test the efficiency of my search query. I'm new to testing and such, but what is the best way to simulate 100/1000/10000 users on a query? Is there a tool (preferably free) that would allow me to perform tests to see how quickly the database can be searched if it had x number of users?
View 1 RepliesI am stored date in "smalldatetime" datatype as in databse.How can i particular textbox entered date(dd-mm-yyyy) used to fetch the row information from databse and shown in a gridview.
View 1 RepliesI need the query to search in LDAP for User's LastName, FirstName
Example:
dey,soumen
this will search in LDAP with user LastName and FristName.
I've been reading up on SQL Injection and want to go back and implement some measures to prevent these kinds of potential attacks.For example, on our company intranet, we have an address book feature and a search function so the user is able to look a company or a person up from the database/The user will enter their query into a TextBox control and click the Submit button, calling the following function:addybookDS1.SelectCommand = "SELECT * FROM [addressbook] WHERE COMPANY LIKE '%" + search1 + "%' OR CONTACT LIKE '%" + search1 + "%' OR LASTNAME LIKE '%" + search1 + "%' OR EMAIL LIKE '%" + search1 + "%'"search1 is the TextBox controlI had previously implemented this measure:search1 = Replace(search1, "'", "''")But I want to know if there is more I can do here and how I can go about doing it.
View 16 Replies