Developer Developer - 1 month ago 17
C# Question

Compare dataset or a better idea

How do I compare values of one data set from another.

1st dataset ["proper records"] is coming from SQL Server with column names

[id], [subsNumber]


2nd dataset ["proper and inproper records"] is coming from progress database, with different columns except 1 which is
subsNumber


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"] ?

or

delete all the records in 2nd dataset["proper and inproper records"] which don't match the "subsNumber" column in the 1st dataset

or any other idea

basically How do I get all records from 2nd dataset which has same "subsNumber" as the 1st dataset

Answer

I solved the problem:

1st dataset--> loop throuhg and get the subsNumber

Call function and pass subsNumber and 2nd dataset--> to it Then start another loop for new dataset

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;
     }
Comments