我不知道如何比较数据集中数据库中的字段。我正在使用Asp.net和c#。
并且在比较两个数据集之后我想在anothere表中插入。任何帮助,谢谢。
public void btnProcess_Click(object sender, System.EventArgs e)
{
if (rdBusinessUnit.Checked == true)
{
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
SqlConnection conn = new SqlConnection(strConn);
string sql1 = "";
string sql2 = "";
try
{
sql1 = "SELECT * FROM CTORGPROJ ";
if (conn.State == ConnectionState.Closed) { conn.Open(); }
SqlDataAdapter da = new SqlDataAdapter(sql1, conn);
da.Fill(ds1, "temp");
//int i="';
//i dont know how to compare in here
sql2 = "select * from PY33PAYRP WHERE PAPBRCH
='ds1.Tables[] [CTPAPBRCH]' ";
SqlDataAdapter daa = new SqlDataAdapter(sql2, conn);
daa.Fill(ds2, "temp");
// ds2.Merge(ds1);
conn.Close();
conn.Dispose();
}
catch { }
}
else if (rdPreviousMonth.Checked == true)
{
}
}