Informix 中执行多条SQL(Execute Script)
有的时候我们需要在ADO.NET中同时执行多条的SQL语法,我们要如何处理,
例如下:
//查詢基本資料
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)的更多相关文章
- c#中执行多条sql语句【ORA-00911: 无效字符】
问题描述: 在plsql里执行多条sql语句的时候,使用“,”(逗号)分隔,测试可以执行多条,而在C#执行多条sql语句的时候[ORA-00911: 无效字符]. 有时我们需要一次性执行多条sql语句 ...
- Mybatis+MySql 一个标签中执行多条sql语句 这个坑 ,我心中有一句MMP
解决办法 转自网友: 亲测 解决了问题@ MySql默认是不支持这种骚操作的,但是并不代表不能实现,只需要在jdbc的配置文件中稍做配置: driver=com.mysql.jdbc.Driverur ...
- Mybatis+MySql 一个标签中执行多条sql语句
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/cxfly957/article/details/77896590 MySql默认是不支持这种骚操作的 ...
- Jmeter JDBC执行多条SQL
今天在编写自动化回归脚本的时候,需要在jmeter的jdbc请求中执行多条sql,在百度里搜索了一些文章,按照网上提供的步骤,发现不起作用,后来发现是作者的截图误导了,为了让后面的同学少走弯路,这里我 ...
- springBoot + mybatis实现执行多条sql语句出错解决方法
在Idea中执行多条sql语句的修改(mybatis默认的是执行sql语句是执行单条,所以要执行多条的时候需要进行配置) 需要在连接字符串中添加上&allowMultiQueries=true ...
- Spring 中jdbcTemplate 实现执行多条sql语句
说一下Spring框架中使用jdbcTemplate实现多条sql语句的执行: 很多情况下我们需要处理一件事情的时候需要对多个表执行多个sql语句,比如淘宝下单时,我们确认付款时要对自己银行账户的表里 ...
- 如何在Oracle中一次执行多条sql语句 (.net C#)
关键是不能换行,要加上begin ...sql... end; 每个SQL用:隔开,end后面必须加: 以下是拷贝于:http://www.cnblogs.com/teamleader/arc ...
- (学)如何在Oracle中一次执行多条sql语句
队长同学原来的地址:https://www.cnblogs.com/teamleader/archive/2007/05/31/765943.html队长同学原来的描述: 有时我们需要一次性执行多条s ...
- C#实现执行多条SQl语句,实现数据库事务
C#实现执行多条SQl语句,实现数据库事务 在数据库中使用事务的好处,相信大家都有听过银行存款的交易作为事务的一个例子.事务处理可以确保除非事务性单元内的所有操作都成功完成,否则不会永久更新面向数据的 ...
随机推荐
- php 错误 Strict Standards: PHP Strict Standards: Declaration of .... should be compatible with that of 解决办法
错误原因:这是由于 php 5.3版本后.要求继承类必须在父类之后定义.否则就会出现Strict Standards: PHP Strict Standards: Declaration of ... ...
- 在 SVG 中添加交互性
原文地址:http://www.ibm.com/developerworks/cn/xml/x-svgint/ SVG 中的交互性可以分为三个领域 -- 链接.事件和脚本.本文将依次讨论这三个领域. ...
- 虚拟化之esxi命令行管理之二
/vmfs # ls -l lrwxrwxrwx 1 root root 4 Mar 23 2013 devices -> /dev drwxr-xr-x 1 root root 512 Sep ...
- Git服务器搭建及SSH无密码登录设置
在Git服务器中建立一个git帐号,用于多人使用. adduser git输入此命令后,会在/home/下建立一个git文件 /home/git 下建立.ssh目录(注意,是.ssh..有个点!) c ...
- MySQL和MongoDB语句的写法对照
查询: MySQL: SELECT * FROM user Mongo: db.user.find() MySQL: SELECT * FROM user WHERE name = ’starlee’ ...
- TKinter之文本域与多窗口
用tkinter做出一个文本框出来,用于写字 代码很简单: #!/usr/bin/env python # _*_ coding:utf-8 _*_ from Tkinter import * roo ...
- android 如何让文本中某个关键字高亮显示?
TextView tv = (TextView) findViewById(R.id.hello);SpannableString s = new SpannableString(getResourc ...
- ASP.NET MVC3升级到ASP.NET MVC4 的方法
ASP.NET MVC3升级 ASP.NET MVC4 的方法: 1.先去掉引用的System.Web.Mvc.dll(MVC3版本),重新引入System.Web.Mvc.dll(MVC4版本) 2 ...
- java连接SQLserver
1.pom.xml添加: <dependency> <groupId>com.hynnet</groupId> < ...
- 【Hadoop环境搭建】Centos6.8搭建hadoop伪分布模式
阅读目录 ~/.ssh/authorized_keys 把公钥加到用于认证的公钥文件中,authorized_keys是用于认证的公钥文件 方式2: (未测试,应该可用) 基于空口令创建新的SSH密钥 ...