Hi i have created a search system at the moment i have connected to a MS database and have created select querys (select, from, where) the user enters a forname or searchname and the results show up in the appropriate textboxes and if there is more than one result the user can use the navigate button to move through the results im just wondering how i would show the results in a datagrid and allow the user to select one of the results and show it in the text boxes rather than what is currently in place....also i have images stored in the databse but dont kno how to display this with the results in my project
any help would be much appriciated

You have to point the datagridview's datasource property to the table you are storing the results

DataGridView1.DataSource = myDataset.Tables("myTable")

As to the pictures, this can be done but is not recommended. It is much better to store the files path to a database and use that path to load the image when the individual record is selected.

Storing images will greatly increase the size of your database and slow the speed of any queries. The pictures themselves take up a lot of space plus every time you edit a record that contains a picture (doesnt even matter if your changing the image or not) the existing record is discarded but still held in storage and a new record created in the database. So if you have two columns (colName & colImage) that has a size of 5mb and you update the name column, you will now have a size of 10mb's in the database for that one record. Doing database maintainaze to shrink or compact the database will help but again its much better to just store the file path compared to storing the pictures.

Hi thanky you for youre post i have been thinking baout the datagrid view and am not sure wether to use the datagrud view or a text box that list the results what is your opinion?

I guess that mostly depends on what info you are displaying. If you want to display multiple records at a time I would use a DGV. If it is only one record at a time then controls such as Labels or Textboxes can be used.

This article has been dead for over six months. Start a new discussion instead.