cmcrae Posted April 22, 2003 Posted April 22, 2003 I am attempting to search a microsoft access file using a vb.net program that I wrote. I want to search a column in one of the tables in the database based on what radiobutton was selected. the tables names are Movies, Books, and Cds. The columns are Title, AuthorArtistStars, Genre, ISBN, Barcode, and a few other columns. Quote
Moderators Robby Posted April 22, 2003 Moderators Posted April 22, 2003 What kind of help are you looking for? With the SQL statement, setting up a DataSet or Datagrid? What kind of controls are you planning on using? Quote Visit...Bassic Software
cmcrae Posted April 22, 2003 Author Posted April 22, 2003 help with searching. I am trying to populate the listbox with the title of the item that matches the search critera. For Ex. let say I am searching the movies that I own for all the movies that have a rating of R. Inside of my database is 3 different tables one for movies, books and cds. All of the tables have similar fields like title, AuthorArtistStars, genre, type, status, discription, etc. I want to be able to search each one of those columns for a part of the string that is contained in the field. Quote
*Experts* Nerseus Posted April 22, 2003 *Experts* Posted April 22, 2003 I don't think you really understand Robby's question. Since no one is going to write the program for you, we just need to know if you need help with: A. Writing the SQL to retreive the right records B. Setting up a database connection (connection string, the objects involved, etc.) C. Binding the listbox to the DataSet or results from a DataReader There are a number of steps to connect to a database and show the results - we're not sure of your level of experience and no one wants to write up 200 lines of sample code if you only need 3 :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
cmcrae Posted April 24, 2003 Author Posted April 24, 2003 more questions I am not tryingto ask you to write a program for me I have written most of it already. Ihave the program populating a listbox and retrieving records and a bunch of other things. What Iam trying to so now is write a search routine that will search the specified table in the access file and then look at the text in the column that you specified for any text that matches your string and then populate the listbox with the title of that item that matches the search string . Quote
*Experts* Nerseus Posted April 24, 2003 *Experts* Posted April 24, 2003 There are a couple of ways to get what you want. You could run a query to do the filtering in a WHERE clause. You could also use the DataTable's Select method, which returns an array of DataRow objects which you could loop through and add items to the Listbox. Or, you could create a DataView with a filter and bind the ListBox to the DataView. Deciding on an option depends on where you want to filter (in the database or in C#/VB code), how often you want to filter (performance considerations), and whether you're already bringing down the whole table that will be filtered or not. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
cmcrae Posted April 25, 2003 Author Posted April 25, 2003 my search What I am searching on depends on the radio button that they select and the text in the text box. The radio buttons are title, genre, ISBN,Barcode,author/artist/stars the radio button signifies the column that you will search all the records for the designated text for. the text can be anything. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.