honeypot Posted March 16, 2004 Posted March 16, 2004 hi there :) i have a windows form, that has a txtSearchName, txtSearchDate and txtSearchOfficer - and a datagrid (which at the moment displays all records of database). What i'd like to achieve is for the user to enter eg. smith in the txtSearchName box and for the datagrid to return all records containing the name smith in the "name" field. I need help desperately with the coding. All sql connections, adapters and dataset are in place. Not sure how to code the txtSearchName box etc. Any help would be much appreciated. Thank you. Quote
wessamzeidan Posted March 16, 2004 Posted March 16, 2004 What do you mean by 'the datagrid to return all records containing the name smith in the "name" field'. You can create a select query from the text in the textbox and display the result in the datagrid....... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Horace Posted March 17, 2004 Posted March 17, 2004 You can change the SQL code in dataset for you aim Change the SQL code in the dataset,and de use the keyword "parameter" for your textbox.text's words And then use a cycle for the data in the database to select all the data which you want to use Quote
techmanbd Posted March 17, 2004 Posted March 17, 2004 Not sure what you need, but the sql statement should look like this dim strSQL as string = "select * from yourtable where NAME like '" & txtsearchname.text & "';" Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
rivierem Posted April 18, 2004 Posted April 18, 2004 Same Problem as yours and i need your help... hello, i have the same problem as yours and i would like to know if you found the solution and if you could please help me... Quote
JABE Posted April 19, 2004 Posted April 19, 2004 If you'd rather not hit the database again w/ a modified query but would just want to filter the current resultset in the datagrid, you can work with a dataview and set its RowFilter property appropriately. 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.