怎样在.cs文件里让2个不同的表的某2个字段值(int)相减?
比如下面的代码怎么让他们2个字段相减?DataView CreateDataSource()
{
OleDbConnection myConnection = new OleDbConnection("provider=sqloledb.1;datasource=(local);uid=sa;pwd=123456;initial catalog=pubs");
OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from dingdan where radio1='已簽回' and bianhao is not null order by id desc", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "dingdan");
return ds.Tables["dingdan"].DefaultView; OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * FROM jiaohuo WHERE jiaohuo_id='"+Request.Params["id"]+"'", myConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "jiaohuo");
return ds1.Tables["jiaohuo"].DefaultView;
myConnection.Close();
Page.DataBind();
}那么假如表dingdan和表jiaohuo里面各有一各字段dingdan_shuliang(int),jiaohuo_shuliang(int),那我怎么让这2各字段值相减?并在.aspx文件里显示???
比如下面的代码怎么让他们2个字段相减?DataView CreateDataSource()
{
OleDbConnection myConnection = new OleDbConnection("provider=sqloledb.1;datasource=(local);uid=sa;pwd=123456;initial catalog=pubs");
OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from dingdan where radio1='已簽回' and bianhao is not null order by id desc", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "dingdan");
return ds.Tables["dingdan"].DefaultView; OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * FROM jiaohuo WHERE jiaohuo_id='"+Request.Params["id"]+"'", myConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "jiaohuo");
return ds1.Tables["jiaohuo"].DefaultView;
myConnection.Close();
Page.DataBind();
}那么假如表dingdan和表jiaohuo里面各有一各字段dingdan_shuliang(int),jiaohuo_shuliang(int),那我怎么让这2各字段值相减?并在.aspx文件里显示???
2 Parse
3 相减
4 显示在控件(比如Label)中