Searching A Set Of Data With Multiple Terms Using Linq?
Mar 17, 2010
I'm in the process of moving from ADO.NET to Linq. The application is a directory search program to look people up. The users are allowed to type the search criteria into a single textbox. They can separate each term with a space, or wrap a phrase in quotes such as "park place" to indicate that it is one term.
Behind the scenes the data comes from a XML file that has about 90,000 records in it and is about 65 megs. I load the data into a DataTable and then use the .Select method with a SQL query to perform the searches. The query I pass is built from the search terms the user passed. I split the string from the textbox into an array using a regular expression that will split everything into a separate element that has a space in it. However if there are quotes around a phrase, that becomes it's own element in the array. I then end up with a single dimension array with x number of elements, which I iterate over to build a long query.
I then build the search expression below:
query = query & _
"((userid LIKE '" & tempstr & "%') OR " & _
"(nickname LIKE '" & tempstr & "%') OR " & _
I have a program that is accessing many similar tables using a linq to sql datacontext. Do linq to sql tables implement a common interface? I would like to write methods that could work with any of the similar tables, so it would be great to do something like
Dim myTable as ILinqDataTable If switch = "TableA" then myTable=myDataContext.TableA Else myTable=myDataContext.TableB
I'm developing an application to help law enforcement retrieve and analyze logs and other files left by the use of Pidgin (a multi-protocol messenger client). Right now I'm nearly done, but I want to add the ability to search chat logs for user-defined words or phrases and I don't even know where to begin.
Chat logs are stored as html documents in a folder/sub-folder/sub-folder/sub-folder fashion, where each sub-folder can have dozens of sub-folders inside of it, and the final sub-folder can have dozens if not hundreds of chat logs. If anybody could point me in the right direction, I'd be very grateful.
(Also, this is the first program I've written since about 2005, and I'm essentially teaching myself VB as I go. If you'd like to see what I've cobbled together so far, you can find the program here.)
I am wanting to create a Where statement within my Linq statement, but have hit a bit of a stumbling block.I would like to split a string value, and then search using each array item in the Where clause.In my normal Sql statement I would simply loop through the string array, and build up there Where clause then either pass this to a stored procedure, or just execute the sql string. But am not sure how to do this with Linq to Entity? ( From o In db.TableName Where o.Field LIKE Stringvalue Select o ).ToList()
Im making an advanced search for a application I need to have an SQL statement that includes all the tables in my db, looks at Cell values and then output to a DGV. This is what Ive tried but it aint working,"SELECT * FROM cases, opencases, staff WHERE Crime='" & txtsearch.text & "'" I need to output the results from all tables into one then insert the table into a DGV. Also need it to search all Columns not just Crime.
Though I know your site ask for some effort on my part im not exactly sure where to start.. I know how to code some decent things and such but recently I wanted to make a serial code system.. What Im looking for is to have a list of Serials on my website (possibly through MySQL? Or something simpler Not sure on this either) I know about the obvious
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "BLAH123" Then MsgBox("Valid Registration key. Thank you")
But I do not like this system as I have no control over multiple uses. I want to pull the keys from my website (hell through a notepad if its easier) therefore allowing me to delete and add serial keys as needed..
I have a code to search through a listbox with mutiple search criteria. Here is the code:[code]When I search for something, how do I make sure I do not obtain 2 of the same results, If both criteria are found, or if all three are found?
I'm using a mysql as my backend database and i'm using the mysqldata adapter for binding the data, i have my data in the database, but the problem is i don't know how to retrieve it, for example when i want to add a record, before i add that record, i want to retrieve the data in my database to trap that the record i'm adding is an existing record
Having read this page, I can't believe that VB.Net has such a terrible performance when it comes to I/O.Is this still true today? How does the .Net Framework 2.0 perform in terms of I/O (that's the version I'm targeting)?
my search function is functional however, it does not behave as what i intended it to be. I have a Text box call Text1 and I have a button called cmdSearch. when i click the cmdSearch, the text in Text will search it in my MS access file here is my code:
Code: Private Sub cmdSearch_Click() RS.Open "SELECT * FROM productTB where Pname like '%" & Text1 & "%'", Con
I am using VS2008 and VB.NET. Can someone provide or point me to info on how to add a Terms and Conditions form to an installation? The user would have to accept in order for the installation to continue or else cancel installation.
my project name is book bank management system i need to give my author's name,book name and number of book's needed in my front end according to tht i want to know whether my book is available or not if available means return the number of books in the database i am using sql server 2005 as back end and visual studio 2008 as front end
I know how to search for one specific number from a single line in an access database using a query, but now I have to search through a whole database and display each instance. Ex) I search the number "1" in column "1" of the database and it has "2" instances. So now I have to take the corresponding data in the rows next to it in order to display them in the label.
I am having to create a data adapter to pull data into a dataset, then loop through that dataset in order to add information into a new column from a separate data source. My first data source is access. My second data source is oracle. Here is the code I have to do this, which works well when I show it in a grid.
Dim da As New OleDbDataAdapter("SELECT tblSummary.WorkOrderNumber, tblLabor.Crew, tblLabor.NumberOfMechanics, tblLabor.NumberOfHoursPerMechanic, tblTasks.TaskNumber, tblTasks.TaskDescription FROM (tblLabor tblLabor INNER JOIN tblTasks tblTasks ON tblLabor.TaskID=tblTasks.TaskID) INNER JOIN tblSummary tblSummary ON tblTasks.JobPlanNumber=tblSummary.JobPlanNumber WHERE
how I can search through this data table. For instance, I want to see only rows that are in this data table that have "Replace" somewhere in the "Description" field, which is the field I added from my second data source. How do I do this? Is there an easier way to do all this instead of filling my dataset from the first source and then adding columns from the second source by looping?
I'm trying to develop a program structure in very broad terms. At this point, the Forms used do nothing but call other Forms and allow for their closure. After startup and initialization activities, I want the user to set up options and run the program. The program can be run again (click one button) and again with the same options, or (click another), the options can be changed for the next and subsequent runs. Clicking a third button will cause shutdown activities to be performed.
Sounds pretty simple. However, I get the options form the first time, but subsequent ShowDialog calls cause the form to pop up (I detected a Load and an Activated call) for an instant, then disappear, and the program rolls on without permitting option selection, even though the key variable NewSetup is definitely True.
Code: Public Class RunMain <STAThread()> _ Shared Sub Main()
I'm using Visual Basic 2006 and i'm a newbie so excuse me if my question is not complete. I basically have a picturebox, in which i am displaying an image from a webcam. Now the user clicks on two points on the image and i need to get the distance between the two points in terms of the number of pixels. I did think of and try the pythagorean theorem, but i'm confused as to what units the answer turns out in. Is it in terms of inches? or pixels? Do i need to set the Scale Mode propety to pixels to get it in pixels? And if so, is there a way to get the number of pixels per inch? Sorry for asking so many questions but i've been reading other forums and i'm confused!
I have a linq union statement that has been giving me some trouble and I can't see where the issue is.The error is....All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.
I know the error means that I am selecting different amounts of elements in one of the linq statements, but I've examined this query extensively and I haven't been able to see that as the issue.