Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

  • *Experts*
Posted

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

"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
Posted

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 .

  • *Experts*
Posted

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

"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
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...