• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't insert data using sql server 2012 stored procedure

#1
Sad 
Hello! First post in this community.
Everytime i tried to insert data using a SQL server 2012 Stored Procedure in codeigniter it throws me the same error message

Quote:A Database Error Occurred
Error Number: 07002/0
[Microsoft][ODBC Driver 11 for SQL Server]Campo COUNT erróneo o error de sintaxis
spa_insert_enterp ?,?,?,?,?
Filename: C:/Apache24/htdocs/sys_credenciales/system/database/DB_driver.php
Line Number: 691


That could be translated to: "sql server - COUNT field incorrect or syntax error"

Heres my CodeIgniter controller code:


Code:
public function agregar_empresa(){
   date_default_timezone_set('America/Santiago');
   $cur_date=date("Y-m-d H:i:s", time());
   $datetime_variable = new DateTime();
   $datetime_formatted = date_format($datetime_variable, 'Y-m-d H:i:s');
   $sp="spa_insert_enterp ?,?,?,?,?";
   $result=$this->db->query($sp,$_POST['nm_rs_empresa'],$_POST['nr_rut_empresa'],$_POST['nm_desc_empresa'],$_POST['nm_rubro'],$cur_date);
   //$query = $this->db->query(      "verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'");

}
I tried with the both date type variables in the code, but nothing happened
Here is my SQL Server Stored Procedure code:

Code:
ALTER  PROCEDURE [dbo].[spa_insert_enterp](
@nm_rs_empresa_in varchar(50),@nr_rut_empresa_in varchar(30),@nm_desc_empresa_in varchar(100),@nm_rubro_in varchar(20),@fc_empresa_in datetime
)
AS
BEGIN TRANSACTION
SET NOCOUNT ON;






insert into empresa
(nm_rs_empresa,nr_rut_empresa,nm_desc_empresa,nm_rubro,fc_empresa)
values
( @nm_rs_empresa_in,@nr_rut_empresa_in,@nm_desc_empresa_in,@nm_rubro_in ,@fc_empresa_in);


commit transaction;

I hope you can help me. Thank to you in advance.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.