Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
hi,
I have two tables in my Database say t1 which is used as a reference table and table t2 which need to be compared, I have a scenario like my previous method returns say row no A of t1  now i need to check Particular columns say gram,milligram and kilogram columns in t1 with the same columns in my t2 and need to check whether my t1 values are less than the t2 values for the Particular columns, If my previous methods returns more than 1 row i need to check the same for all the rows which it has returned at once,

how can i achieve this? I am using C# and SQL Ce 


What I have tried:

C#
private void btnSearch_Click(object sender, EventArgs e)
       {
            object result = dbCon.ExecuteReader("SELECT  C.Type FROM  Material_Declaration AS M INNER JOIN Total_Chemicals_List AS C ON M.CAS_Number = C.CAS_Number and M.CAS_Number <> 'No CAS' WHERE (M.Part_Number_ID = '" + txtPart.Text + "') AND (C.Type IS NOT NULL) ");
            if (result != null)
            {
result = dbCon.ExecuteReader("SELECT  Substance_Mass,Substance_Percentage FROM Material_DeclarationAS M WHERE EXISTS (SELECT Mass_in_mg, Weight FROM  Total_Chemicals_ListAS C WHERE (M.Substance_Mass &lt; C.Mass_in_mg) and (C.Type = " + result.ToString() + ")");
If (result != null)
{
 ABC();
}
Posted
Updated 29-Nov-16 20:16pm

1 solution

 
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