DB search form

frank

Member
Joined
Sep 9, 2005
Messages
5
Programming Experience
Beginner
I have a form that conects to an aceess database and would like to be able to perform a search. I would like to either :
1)
Have 3 text boxes, First and Last name and dob that the user can input the parameters and then click search. this can then show the results in a datagrid (or other form). Once in the data grid can the user click on the row they want so that it populates my form with all the fields from the db.


2)
Is pretty much the same as 1 but I just have a datagrid with all the db rows in (SELECT*FROM members). and I scroll down and click on the member I want to edit etc.

There may be a far better way to search but I dont know it.
I would rather have the search results in a seperate form so if there is a duplictate name "JOHN SMITH" then I can choos which one.

Thanks

Frank
 
Thread moved to more appropriate forum.

Make the DataGrid read-only and bind it to the DataTable containing your data. When the user clicks your Search button, set the DefaultView.RowFilter property of the DataTable based on the values in your TextBoxes, which will automatically update the data in the grid. You can then handle the DoubleClick event of the DataGrid and pass the field values from the selected row, or in fact the row itself, to your editing dialogue when you open it.
 
I have the datagrid poulated with the data from my members table (only have 5 fields First name, last name, dob, streetname and memberid) The form i use to edit/add/browse has about 20 fields.

I am not sure on the code for the double click bit to then poulate all 20 fields in the data form.

The memberid is column 4 in the data grid and so I hoped as I double click the datarow I could asign the value in the member ID value to a integer variable and then update the form based on the memberID.

I cannot understandhow to do this. Is this the correct way?
 
Back
Top