wessamzeidan Posted February 10, 2004 Posted February 10, 2004 How can I search for a string in a dataset.... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
I Schobert Posted February 10, 2004 Posted February 10, 2004 Could you tell me what you will do with the string once you have found it? What is the issue? Do you know in which table and column the string is? Quote IS
wessamzeidan Posted February 10, 2004 Author Posted February 10, 2004 yes I know, I know in which databale and in which column, but I need to search for part of a string, ex if the search string is 'fr', all the datarows that contain 'fr' in that column should be returned Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
I Schobert Posted February 10, 2004 Posted February 10, 2004 Well, I would try something like this: First, create a clone of the original datatable, which is a shallow copy with the appropriate columns. Next, loop through the datarows of your table like: For each dr as DataRow in myDataSet.Tables(0).Rows 'here find if the substring "fr" exists 'in the dr.Item(columNumber) 'If you found it, then copy the datarow to your new datatable Next Once, all is done, you will have a datatable with only records containing your substring. Hope this helps... Quote IS
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.