当前位置:Gxlcms > 数据库问题 > Informix 中执行多条SQL(Execute Script)

Informix 中执行多条SQL(Execute Script)

时间:2021-07-01 10:21:17 帮助过:23人阅读

查詢基本資料 private static void TestQry() { DataTable dtReturn =new DataTable(); //查詢基礎資料 try { //模擬查詢原始資料 string strSql1 = @" Select id,name from databasename@dblinkname:tablename union Select id,name from databasename@dblinkname:tablename into temp tmp_tablename with no log; "; string strSql2 = @" select * from tmp_tablename; "; string strSql3 = @" drop table tmp_tablename; "; using (IfxConnection conn = new IfxConnection(gsConnStr)) { using (IfxCommand cmd = new IfxCommand(strSql1, conn)) { conn.Open(); // cmd.CommandType = CommandType.Text; cmd.CommandText = strSql1; cmd.ExecuteNonQuery(); using (IfxDataAdapter ad = new IfxDataAdapter(strSql2, conn)) { ad.Fill(dtReturn); } cmd.CommandType = CommandType.Text; cmd.CommandText = strSql3; cmd.ExecuteNonQuery(); conn.Close(); } } } catch (Exception ex) { dtReturn = null; Console.WriteLine(ex.Message); } }

 

Informix 中执行多条SQL(Execute Script)

标签:lin   and   .com   ble   new   close   ati   null   name   

人气教程排行