如何使用 SQL SERVER 在 CodeIgniter 中调用存储过程 [英] How to call a stored procedure in CodeIgniter USING SQL SERVER

查看:46
本文介绍了如何使用 SQL SERVER 在 CodeIgniter 中调用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Codeigniter 和 SQL 服务器作为我的数据库构建我的应用程序(我使用 SQLSRV PHP 扩展连接到 SQL).当我尝试调用存储过程时会出现问题:

I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures:

$query = $this->db->query(
          "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); 

<小时>

我尝试用较少数据创建查询的另一种方法如下,但是,它产生了错误:


Another way I have tried to create the query with less data is the following , however, it is generating an error:

Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Ejecutando SQL directamente, sin cursor. EXECUTE provando15 34,2,'key05','2015-07-22'

我真的不知道我做错了什么.有人可以帮我吗?

I dont really know what im doing wrong. Can someone please help me?

推荐答案

去掉执行这个词,它会起作用.

remove the word Execute and it will work.

$query = $this->db->query(
      "verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'");

这篇关于如何使用 SQL SERVER 在 CodeIgniter 中调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆