Problems With Null Text Boxes When Doing Like Search
Apr 10, 2007
I have three text boxes firstname, lastname, dob. It is set up to do a like search on the the text boxes. If a user wants to do a search for just the last name it will not work. You must type in something in all three boexes. Doesn't anybody know how to correct this. Here is the code. Thanks.
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GridView1.Visible = False
GridView2.Visible = False
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
GridView1.DataSourceID = "SqlDataSource1"
GridView1.DataBind()
GridView2.DataSourceID = Nothing
GridView2.DataBind()
GridView1.Visible = True
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
GridView2.DataSourceID = "SqlDataSource2"
GridView2.DataBind()
GridView1.DataSourceID = Nothing
GridView1.DataBind()
GridView2.Visible = True
End Sub
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs)
SelectCommand="SELECT * FROM [Full File through 2006] WHERE (([FIRST] LIKE '%' + @FIRST + '%') AND ([LAST] LIKE '%' + @LAST + '%') AND ([DOB] LIKE '%' + @DOB + '%'))" OnSelecting="SqlDataSource1_Selecting">
Hi, I am doing a report in which i have to create Wall chart kind of layout and for that i have to place Text Boxes on the report at run time.Now In my Layout i have some Text Boxes which are going Out of the page(Starts from page 1 and Ending on page 2)but when i am looking my report in the Print Preview the Report Viewer is shifting the entire Text Box to Page 2. Can i do something to print the report as they are seen in the Normal layout.
I would like a form that has 3 text boxes. These 3 boxes are going to be used for entering search criteria. The first box is for searching a field called CasePK. The second is for searching a field called LinePK and the third is for searching a field called DOS. DOS is a date field. The other two are text fields.I am using a SQLDATASOURCE and a Gridview. What will the SelectCommand look like so that I can search the 3 fields using the data from the textboxes?
Hi,Hope if someone can help me here. Keep in mind I an fairly new to .NET and SQL and am learning to break my MS Access habit :) I have a web form that is using a SqlDataSource and a FormView control. In addition to this I have 2 text boxes. What I am trying to do is display results in the FormView based on what a user types into one of the Text Boxes (one or the other…Not both)
The SELECT statement in the SqlDataSource looks like this in concept. SELECT Field1, Field2, Field3, Field4FROM dbo.MYTABLEWHERE (Field1 = @Field1) AND (Field2 IS NULL)OR (Field2 = @Field2) AND (Field1 IS NULL)
I have the two text boxes pointing at the parameters (@Field1 and @Field2) so in theory I would expect that when a user populates one of the text boxes and clicks a button to databind the FormView it would display a record matching that criteria…. But it’s not all I get is a blank/missing FormView. I tried different variations on the SQL statement and tried using = '' instead of IS NULL but still the same results. However, if I populate one text box with a value that I know is not in my table and populate the other with a value of which I know exists in my table is…It works.What am I missing?
how visibility can be toggled between two textboxes in ssrs? For example if textbox1 is visible and textbox2 is hidden initially and textbox2 should be visible when clicked on textbox1 and textbox1 should go invisible when textbox2 is shown... and then again when clicked on textbox2, textbox1 should be visible and textbox2 should go invisible.In a short, it is like switching visibility between 2 textboxes... A click on first textbox should display the second textbox and another click on second text box should display first text box.I cannot provide parameter as it is not there in the requirement. how to toggle the text within a single text box to fulfill above requirement...
Several textboxes are being on a web form for date entry. and we want to allow the user to leave date fields blank (if particular date is unknown). However, when the field is left blank, the SQL Server 2000 database defaults to 1/1/1900 (datatype = datetime).My question is as follows: How is it possible to leave a date textbox field blank, and either send 00 0 000 or spaces to the SQL Server 2000 database datetime field?Any advice/insight is appreciated! Rob
Hi folk.. can some body help me with this problem..???
I have a grid view on a form which has got colums which are set as data combo boxes. and a third column whish is set to a text box. all the 3 controls on the datagrid view are bound with sql server table. they are asociated with two saparate tables within 1 database... now what i want is that the user of the application can select either combo box 1 of teh 2nd combo box. and automatically the syncronize and also the text column asociates with related data..
for example
Country City Pincode India vasco 403802
now while flling the grid vew.. the user can select either country or city.. automatically both syncronize with related data and so does the text box.
I have a user table with Label and value fields where i would like to control the display of the text boxes based on the values selected in my user table.Can we adjust the text box positions dynamically based on the user table values.
Ex: Table
Label1 Field1 Label2 Field2 Label3 Field3 ID 100 Dept Sales
Report Design :
Label1: ID Field1:100 Label2: Field2: Label3:Dept Field3:Sales
Expected Result :
Label1: ID Field1:100 Label3:Dept Field3:Sales
In my table i don't have values for Label 2 & Field 2 , can we adjust the spacing conditionally to be utilized by Label3 & Field3 in SSRS.
Note : Above mentioned data is just for an example and in my actual report i can have more than 3 columns and report is looking ugly with all the spacing if i don't have data in all the fields.
Hi - I'm short of SQL experience and hacking my way through creating a simple search feature for a personal project. I would be very grateful if anyone could help me out with writing a stored procedure. Problem: I have two tables with three columns indexed for full-text search. So far I have been able to successfully execute the following query returning matching row ids: dbo.Search_Articles @searchText varchar(150) AS SELECT ArticleID FROM articles WHERE CONTAINS(Description, @searchText) OR CONTAINS(Title, @searchText) UNION SELECT ArticleID FROM article_pages WHERE CONTAINS(Text, @searchText); RETURN This returns the ArticleID for any articles or article_pages records where there is a text match. I ultimately need the stored procedure to return all columns from the articles table for matches and not just the StoryID. Seems like maybe I should try using some kind of JOIN on the result of the UNION above and the articles table? But I have so far been unable to figure out how to do this as I can't seem to declare a name for the result table of the UNION above. Perhaps there is another more eloquent solution? Thanks! Peter
Our clients want to be able to do full text search with a single letter. (Is the name Newton, Nathan, Nick?, Is the ID N1, N2...). Doing a single character full text search on a table work 25 out of 26 times. The letter that doesn't work is 'n'. the WHERE clause CONTAINS(full_text_field, ' "n*" ') returns all rows, even rows that have no 'n' in them anywhere. Adding a second letter after the "n" works as expected.
Here is an example
create table TestFullTextSearch ( Id int not null, AllText nvarchar(400) ) create unique index test_tfts on TestFullTextSearch(Id); create fulltext catalog ftcat_tfts;
I have a scenario of where the standard Full-Text search identifies keywords but Semantic Search does not recognize them as keywords. I'm hoping to understand why Semantic Search might not recognize them. The context this is being used in medical terminology and the specific key words I noticed missing right off the bat were medications.
For instance, if I put the following string into a FT indexed table
'J9355 - Trastuzumab (Herceptin)' AND 'J9355 - Trastuzumab emtansine'
The Semantic Search recognized 'Herceptin' and 'Emtansine' but not 'Trastuzumab'
Nor in
'J8999 - Everolimus (Afinitor)'
It did not recognize 'Afinitor' as a keyword.
In all cases the Base of Full-Text did find those keywords and were identifiable using the dmvsys.dm_fts_index_keywords_by_document.It does show the index as having completed.
why certain words might not be picked up while others would be? Could it be a language/dictionary issue? I am using English and accent insensitive settings?
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?
I have installed the Adobe iFilter 11 64 bit and set the path to the bin folder. I still cannot find any text from the pdf files. I suspect I am missing something trivial because I don't find much when I Bing for this so it must not be a common problem.Here is the code.
--Adobe iFilter 11 64 bit is installed --The Path variable is set to the bin folder for the Adobe iFilter. --SQL Developer version 64 bit on both Windows 7 and Windows 8. USE master; GO DROP DATABASE FileTableStudy; GO CREATE DATABASE FileTableStudy ON PRIMARY
I have Sql server 2005 SP2. I enabled it for Full Text search. Substring search where i enter *word* doesn't return any row. I have a table testtable where description has word Extinguisher.
If i run a query with *ting* it doesn't return any row. select * from testtable where contains(description,'"*xting*"') ;
But it works if i do select * from testtable where contains(description,'"Exting*"') ;
The Full text search document says it supports substring search. Is it an issue with sql server 2005?Please help.
I am using Sql Server 2014 Express edition.I have a table with a varchar(max) column. I have created a full text search that use the stoplist "system". column has this struct: xxx.yyy.zzz.... where xxx, yyy, zzz... are numbers, like 123.345.123123.366456...I can have rows like that:
select * from Mytable where contains(MyColumn, '123.345.')
I gues the contains would return all the rows with column contains 123.345, but this does not return all the expected rows, only one row.I have tried to replace "." with "-" but the result is the same.I have also tried with '123.345.*. In this case I have got more results, but no all the exptected rows.If I use this query:
select * from MyTable where MyCOlumn like '123.345.%';
Hi, i'm trying to do a full text search on my site to add a weighting score to my results. I have the following database structure: Documents: - DocumentID (int, PK) - Title (varchar) - Content (text) - CategoryID (int, FK) Categories: - CategoryID (int, PK) - CategoryName (varchar) I need to create a full text index which searches the Title, Content and CategoryName fields. I figured since i needed to search the CategoryName field i would create an indexed view. I tried to execute the following query: CREATE VIEW vw_DocumentsWITH SCHEMABINDING ASSELECT dbo.Documents.DocumentID, dbo.Documents.Title, dbo.Documents.[Content], dbo.Documents.CategoryID, dbo.Categories.CategoryNameFROM dbo.Categories INNER JOIN dbo.Documents ON dbo.Categories.CategoryID = dbo.Documents.CategoryID GOCREATE UNIQUE CLUSTERED INDEX vw_DocumentsIndexON vw_Documents(DocumentID) But this gave me the error: Cannot create index on view 'dbname.dbo.vw_Documents'. It contains text, ntext, image or xml columns. I tried converting the Content to a varchar(max) within my view but it still didn't like. Appreciate if someone can tell me how this can be done as surely what i'm trying to do is not ground breaking.
Hello everyone ! I want to perform Full Text Search with SQL Server 2000. My documents (.doc, .xls, .txt, .pdf) are stored in a SQL Server field which is binary (the type of the column is image). I would like to know, how you can extract pieces of text from the documents. Example: I have a ASPX page with codebehind in C# making the search in a table in SQL server that is full text indexed. I make a search looking for the word "peace", than SQL server will take care about the search and return it to me the rows that match with that. But also I'd like to extract the 50 characters before and after where sql server found the word "peace" to show in the result page. Does anyone has any idea how to work around it ? Best regards. Yannick
i have a form where filter information is going to be keyed/selected. the data from that form is copied into a struct regardless of whether each field has data in it or not (eg firstname may have been entered but not lastname, so the struct would contain firstname = 'john' and lastname = null) i then want to build an sql statement (not using stored procedures but just direct sql) from this struct data but obvioulsy can't just have a statement that says 'select ID from theTable where firstname='john' AND lastname=''" as this won't bring back the right info, if anything at all.
i normally build the statements like this
Code Block string sql = "select ID from MembersTemp where FirstName = '{0}'"; SqlCommand cmd = new SqlCommand(string.Format(sql, FirstName), _con); _con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); List<int> result = new List<int>(); while (rdr.Read()) { etc....
so really, what's the best way of building an sql statement where some search parameters won't hold a value and therefore need ignoring.
also, whilst i'm here, i use viz studio 2005 and sql server 2005 (express??), so that does mean i'm using TSQL as well??
before I wade in and try to create a text search facility on my SQL server DB, can somebody point me in the right direction for a search ranking SQL query?
I need the user to input two or three keywords into a search field and for the (small) DB to return a handful of rows in order of popularity of the keywords.
I gather from my other post that I will need to be mindful of SQL injections but that's another issue.
Hi I have a full text index on my product table. When I do a search for Record, it returns all values for Record and Records.Now If I do a search with a spelling mistake say Recod . it doen't return anything.How can I get the full text to return my query even if there is a spelling mistake ? Thanks My query:SELECT * From Product WHERE FREETEXT (description, @SearchString)
hi all.i want to search, for example :"test string" in database : table have column(name) , i want to search all rows with column(name) is "test " or "string" or "test string"i don't want to use(full text search of sqlserver 2005 ) can i help me.thanks in advance
Hi I have a .net 2 website that works from a sql 2000 db. I am building a form that will allow the user to type in any search criteria and based on their input I need to produce some results (that’s the simplest way to put it)I will need to search various parts of my db to find similar sounding information, I was just wondering what is the best way to do this. I had the following thoughts1) Search columns using Soundex tsql function (but not sure how good this is?)2) Remove all noise words from user input (eg, and, or, the etc...) and then use a regular expression to search the fields in the dbAlternatively are their some third party components to do can do this for me Many thanks in advance
Hello ! With SQL Server Management Studio Express I have created a catalog and a index.Here is the code : create fulltext catalog myfirstcatalogcreate unique index myfirstindex on northwind.dbo.customers(companyname)create fulltext index on northwind.dbo.customers(companyname)key index myfirstindex ON myfirstcatalogWITH CHANGE_TRACKING AUTO With SQL Server Management Studio Express and the following command the full text search is working fine. select companynamefrom northwind.dbo.customerswhere contains(companyname, ' "blauer" ') I have a big problem : When I try to use this database (NOTRHWIND.MDF) into my .aspx file with VWD 2008 I get an error : Cannot use full-text search in user instance.
Can you tell me what can I do to make use of full-text search inside my aspx pages ? Thank You !
does anyone have code that shows how to separate individual words from a sentence.
e.g. i have a list of questions and answers in my database and have the following query for it:
SELECT question, Answer FROM QuestionsAnswer WHERE FREETEXT(Question, 'i want to travel around the world and learn about cooking')
so i want to extend the above query so that takes each key word (travel, cooking, learn) to find out how frequently that particular word appears in the question (for ranking purposes).
I know freetexttable does rank results, but they don't seem accurate enough for what i need to do.