http://stackoverflow.com/questions/4391573/mysql-asp-net-存储过程 [ ^ ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'InsertProcedure' at line 1Stored Procedure :drop procedure if exists insert_pdf_data;delimiter #create procedure insert_pdf_data(in BatchName varchar(20),in ClientNm varchar(30))begininsert into PdfEntry(BatchName,ClientNm) values (BatchName,ClientNm);end#delimiter ;c# code :try { con = new OdbcConnection("DRIVER={MySQL ODBC 5.1 Driver};SERVER=192.168.0.10;DATABASE=PDF_Data;UID=heman;PASSWORD=harjeet;OPTION=3"); con.Open(); cmd = new OdbcCommand("insert_pdf_data", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BatchName", DDBatch.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@ClientNm", DDClient.SelectedValue.ToString()); cmd.ExecuteNonQuery(); con.Close(); Response.Write("<Script>alert('Data added successfully')</Script>"); } catch (Exception err) { } finally { con.Close(); } 解决方案 hiplease use this lnik i think this will help youwww.mysqltutorial.org/stored-procedures-parameters.aspx[^]http://stackoverflow.com/questions/4391573/mysql-asp-net-stored-procedures[^] 这篇关于MySql存储过程中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-25 19:15