Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.......

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

Posted

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

Posted

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 & "';"

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi
  • 1 month later...
Posted

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...

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

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...