我检查了与互联网相关的所有内容都与他们说的一样,我只是无法理解错误,请尽早帮助我。
//stored procedure
DELIMITER $$
DROP PROCEDURE IF EXISTS `manoj`.`SP_inserttbluserregistration` $$
CREATE DEFINER=`root`@`syits04-pc` PROCEDURE
`SP_inserttbluserregistration`(IN FIRSTNAME1 varchar(500),IN LASTNAME1
varchar(500),IN EMAIL1 varchar(500),IN USERTYPE1 integer,IN USERNAME1
varchar(500),IN PASSWORD1 varchar(500),IN STATUS1 INTEGER,IN UPDATESTATUS1
INTEGER,IN DELETESTATUS1 INTEGER)
BEGIN
insert into
tbluserregistration(FIRSTNAME,LASTNAME,EMAIL,USERTYPE,USERNAME,PASSWORD,STATUS,UPDATESTATUS,DELETESTATUS) VALUES(FIRSTNAME1,LASTNAME1,EMAIL1,USERTYPE1,USERNAME1,PASSWORD1,STATUS1,UPDATESTATUS1,DELETESTATUS1);
END $$
DELIMITER;
//这是c#的代码
MySqlCommand cmdi = new MySqlCommand("SP_inserttbluserregistration", GetConnection.GetConnectionOpen());
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("FIRSTNAME1", FIRSTNAME);
cmd.Parameters["FIRSTNAME1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("LASTNAME1", LASTNAME);
cmd.Parameters["LASTNAME1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("USERTYPE1", USERTYPE);
cmd.Parameters["USERTYPE1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("EMAIL1", EMAIL);
cmd.Parameters["EMAIL1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("USERNAME1", USERNAME);
cmd.Parameters["USERNAME1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("PASSWORD1", PASSWORD);
cmd.Parameters["PASSWORD1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("STATUS1", 0);
cmd.Parameters["STATUS1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("UPDATESTATUS1", 0);
cmd.Parameters["UPDATESTATUS1"].Direction = ParameterDirection.Input;
cmd.Parameters.AddWithValue("DELETESTATUS1", 0);
cmd.Parameters["DELETESTATUS1"].Direction = ParameterDirection.Input;
object isInserted = cmdi.ExecuteNonQuery();
if (isInserted != null)
{
return true;
}
else
{
return false;
}
}
错误
您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第1行的“SP_inserttbluserregistration”附近使用正确的语法
答案 0 :(得分:0)
你的引号(`)是错误的。有时,当您剪切和粘贴时,会使用不正确的字符。尝试将所有(')字符替换为(')而不是(`)