Hi, I have a JSON after deserialization. Now I have to compare multiple tag values in JSON with values fetched from SQL database. How can we do with minimum number of activities. I have created array of values fetched from database but while iterating with for or if the code is becoming long and complex.
If there is any other way(maybe data table etc), please suggest that too.
I have a deserialized JSON array as below:
“empDetails”: [ {
“name”: “MARK”,
“empID”: “687014”,
“deptAssigned”: “Chemistry”
}]
And I have above details fetched from my OLTP database in form of DataTable variable. Now I need to compare all the values from above JSON(like MARK, 687014 etc) to values fetched from Database. What all values are matching and what are not. Need to capture what values are not matching and fail the scenario.
We do feel that we can approach within a compact way. But from description we cannot derive all needed details. (e.g. 1 Json, with 30 emps, 30 json with 1 emp, the datatable from OLTP, …)
Also
row-wise check, colum-check, how to mark the non matchers…
Sorry for not mentioning this but data will be as below.
1 JSON will have 1 employee details with 30 different attributes for that 1 employee.
Same is the case with DB values datatable. Values fetched will have details of 1 employee with those 30 attributes values fetched from database.
(From p In myJObject("empDetails").First().Value(Of JObject).Properties
Let jv = p.Value.Value(Of String).Trim
Let ov = dtOLTP.Rows(0)(p.Name).toString.Trim
Where Not jv.Equals(ov)
Let ra = New Object(){p.Name, jv,ov}
Select r = dtReport.Rows.Add(ra)).CopyToDataTable