I have the two following queries, the first one is directly inserting while the second query is checking if the record exists first, then if it does it will stop insert if not then it will insert.
Working
query1 = "INSERT INTO dbo.SAP_Mat_StoreBGA (Material,MaterialDescr)
VALUES ('" + row["Material"] + "','" + row["MaterialDescr"] + "')";
Not Working
query1 = "IF NOT EXISTS (
INSERT INTO dbo.SAP_Mat_StoreBGA (Material,MaterialDescr)" + "
VALUES ('" + row["Material"] + "','" + row["MaterialDescr"] + "')
)";
Please help me get the "not working" query working.