System.Data.SqlClient.SqlConnection conn1 = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DBContext"].ToString());
string query1 = string.Format(
@"SELECT DISTINCT HEADNM
FROM TABLE_ONE A INNER JOIN TABLE_TWO B ON A.COMPID = B.COMPID AND A.CHARGEID = B.HEADID AND B.HEADTP = 'ABC'");
System.Data.SqlClient.SqlCommand cmd1 = new System.Data.SqlClient.SqlCommand(query1, conn1);
conn1.Open();
SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
DataTable ds1 = new DataTable();
da1.Fill(ds1);
foreach (DataRow parentRow in ds1.Rows)
{
.......
.......
.......
.......
}
No comments:
Post a Comment