怎么样将A表中的1,2,3三个字段读出并将1,2合并之后写入到B表。数据是多个的。
解决方案
10
insert into tableB(fB1,fB2) select fA1+fA2,fA3 from tableA
25
ADO.NET操作,如下这样的
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"].ToString());
con.Open();
SqlCommand com = new SqlCommand("insert into tableB(fB1,fB2) select fA1+fA2,fA3 from tableA", con);
if(com.ExecuteNonQuery()>0)
{
//提示成功
}
else
{
//提示失败
}
com.Dispose();
con.Close();
5
4#正解。