本文介绍了如何修复“?在集合中找不到idparam“在mysql中插入存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am writing an insert query in mysql stored procedure .when i am trying to run i am getting error "?IDparam not found in collection" .I didnt give ID in insert as it should be autoincremented and i use it in update and delete later in this procedure.
This is Insert query from my proc:
<pre>CREATE DEFINER=`root`@`%` PROCEDURE `insertproc`(
IN IDparam INT,
IN Pathparam VARCHAR(100),
IN fileNameparam VARCHAR(100),
IN Countparam VARCHAR(100),
IN CreatedBYparam DATETIME,
IN CreatedDateparam DATETIME,
IN Typeparam VARCHAR(100),
IN Statusparam VARCHAR(100),
IN crudparam VARCHAR(50))
BEGIN
IF(crudparam ='INSERT')
THEN
INSERT INTO pathmaster (
Path,
pathName,
fileName ,
Count,
CreatedBY,
CreatedDate,
Type,
Status
)
VALUES(
Pathparam,
(Select MAX(pathName) from pathmaster)+1,
FileNameparam,
Countparam,
CreatedBYparam,
CreatedDateparam,
Typeparam,
Statusparam
);
END IF;
以下是拨打SP的代码
below is code to call SP
MySqlParameter[] mysqlparam = new MySqlParameter[]
{
new MySqlParameter("Pathparam",Path.Trim()),
new MySqlParameter("FileNameparam",filename.Trim()),
new MySqlParameter("Countparam",count),
new MySqlParameter("CreatedBYparam",date),
new MySqlParameter("CreatedDateparam",date),
new MySqlParameter("Typeparam",strType),
new MySqlParameter("Statusparam","pending"),
new MySqlParameter("ACTIONparam","INSERT")
};
ds = ExecuteProc("insertproc", mysqlparam);
所以可能是什么问题
我尝试过:
将ID列更改为varchar无效。参数中没有任何空格。
so what may be the problem
What I have tried:
change ID column to varchar didnt work. there are no any whitespaces in parameters.
推荐答案
这篇关于如何修复“?在集合中找不到idparam“在mysql中插入存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!