日期:2014-05-18 浏览次数:21003 次
string strSQL = "select sum(t1.jine)+sum(t2.jine)+sum(t3.feiyong) as total from biao1 t1,biao2 t2,biao3 t3 where t1.liushuihao =t2.liushuihao and t1.liushuihao = t3.liushuihao and t2.liushuihao =t3.liushuihao"; int ret = 0; using(SqlConnection con = new SqlConnection("Data Source=.;uid=sa;pwd=sa;Database=xxx")) { con.Open(); using(SqlCommand cmd = new SqlCommand(strSQL,con)) { ret = (int)cmd.ExecuteScalar(); } } string s = "总金额为:"+ret.ToString();