如何使用输入id在数据表上逐行搜索数据并将结果保存到另一个数据表中 [英] how to search row by row data on a datatable using an input id and save the result into another datatable

查看:71
本文介绍了如何使用输入id在数据表上逐行搜索数据并将结果保存到另一个数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我...

我有一个带数据的数据表,现在我需要根据输入ID搜索每一行数据,

其中输入id是数据表的列之一..请帮助我

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

推荐答案

因此,如果我正确理解了这种情况,您已经将Excel中的数据读入数据表。如果是这种情况,一种方法是使用 SELECT [ ^ ]数据表的方法。类似

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
foreach (DataRow dr in mydatatable.Select("MyColumn = '" + stringVariable"'") ...



当然,确切的格式取决于您的数据表结构和输入的类型。


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


这篇关于如何使用输入id在数据表上逐行搜索数据并将结果保存到另一个数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆