用sql语句比较:select A.sj,b.sj,cast(A.sj as int)-cast(b.sj as int) as Diffrnece from From tb1 a left Join tb2 b On tb1.bh = tb2.bh 或者用你所说的数据集: string bh; foreac(DataRow r in ds.Tables["tb1"].Rows) { bh= r["bh"].tostring(); int temp1= System.Convert.toInt32(r["sj"].tostring()); DataRow[] foundRows = ds.Tables["tb2"].Select("bh='"+bh+"'"); int temp2 =System.Convert.toInt32(foundRows[0]["sj"]tostring()); if(temp1>temp2)
{
大值=tb1.Rows[i]["sj"]>tb2.Rows[i]["sj"]?tb1.Rows[i]["sj"];tb2.Rows[i]["sj"];
}
{
}
From tb1 a left Join tb2 b On tb1.bh = tb2.bh
或者用你所说的数据集:
string bh;
foreac(DataRow r in ds.Tables["tb1"].Rows)
{
bh= r["bh"].tostring();
int temp1= System.Convert.toInt32(r["sj"].tostring());
DataRow[] foundRows =
ds.Tables["tb2"].Select("bh='"+bh+"'");
int temp2 =System.Convert.toInt32(foundRows[0]["sj"]tostring());
if(temp1>temp2)
{
//判断的结果
}}