比较数据集或一个更好的主意 [英] Compare dataset or a better idea
问题描述
我如何从另外一个比较一个数据集的值。 第1集[妥善纪录] (从SQLSERVER的到来,与列名[ID],[ subsNumber ]),
How do I compare values of one data set from another. 1st dataset["proper records"](coming from sqlserver, with column name [id],[subsNumber]),
第2集[适当和inproper记录] (除1从Progress数据库的到来,均拥有不同的coulums是[ subsNumber ])。
2nd dataset["proper and inproper records"](coming from progress database, with diffrent coulums except 1 which is[subsNumber]).
我怎么去,使有另一个数据集中的所有[subsNumber]从[妥善纪录]从第二datset匹配的记录[适当inproper记录]
how do I go and make another dataset which has all the [subsNumber] from ["proper records"] with matching records from 2nd datset["proper inproper records"]
或
删除第二个数据集中的所有记录[适当和inproper记录]不将subsNumber列匹配的第一个数据集
delete all the records in 2nd dataset["proper and inproper records"] which don't match the "subsNumber" column in the 1st dataset
或任何其他的想法
基本上我如何获得第二个数据集具有相同的subsNumber作为第一个数据集的所有记录
basically How do I get all records from 2nd dataset which has same "subsNumber" as the 1st dataset
推荐答案
我解决了这个问题:
第1集 - >环throuhg并获得subsNumber
1st dataset--> loop throuhg and get the subsNumber
通话功能,并通过subsNumber和第2集 - >将其 然后开始另一个循环的新的数据集
Call function and pass subsNumber and 2nd dataset--> to it Then start another loop for new dataset
继续,如果subsnumber不匹配 如果这些数据subsNumber匹配工作,像添加列SQLSERVER表等。
Continue if subsnumber don't match If subsNumber match work on that data like add columns to sqlserver table etc.
code:
foreach (DataRow row in ecommDS.Tables["EcommData"].Rows)
{
//string statCode = ""
string prdCode = ""; //declaring var for getting string format from ecomm
string checking = "";
prdCode = row["PRD-CDE"].ToString();
checking = row["SUBS-NUM"].ToString();
if(checking != subsNum)
{
continue;
}
这篇关于比较数据集或一个更好的主意的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!