Click Here

相信能,才能
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

执行多条SQL语句

Posted on 2006-07-13 01:15  鬼手  阅读(380)  评论(0)    收藏  举报

分号是sql的换行符,如:

.
myConnection.Open();
string str="Select * INTO ##temp from [table1];";
str
+="Delete From [table1];";
str
+="INSERT INTO [table1]";
str
+=" Select * from ##temp;";
str
+="Drop Table ##temp";

SqlCommand myComm
=new SqlCommand(str,myConnection);
myComm.ExecuteNonQuery();

myConnection.Close();
.