Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Anyone please help me...
I have a datatable with data,now i need to search the each row data based on input id,
where input id is one of the column of datatable ..please help me
Posted
Comments
PIEBALDconsult 8-Sep-15 17:23pm    
Do you mean an ADO.net DataTable? Or a table in a database?
If the former, don't search it, use the RowFilter Property of the DefaultView.
NagaNimesh 11474558 8-Sep-15 17:35pm    
it is not a ado.net jst a winforms applicaiton
NagaNimesh 11474558 8-Sep-15 17:38pm    
i will explain it clearly..,
i have a excel file ,read the data into datatable.but i need to search the data based on user give "inputid" so based on that id the entire row has to be picked

1 solution

So if I understand the situation correctly, you have already read the data from Excel into a data table. If that is the case, one way is to use SELECT[^] method of the datatable. Something like
C#
foreach (DataRow dr in mydatatable.Select("MyColumn = '" + stringVariable"'") ...

Of course the exact format depends on your datatable structure and the type of your input.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900