Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 1

Stored Procedure :
SQL
drop procedure if exists insert_pdf_data;
delimiter #
create procedure insert_pdf_data
(
in BatchName varchar(20),
in ClientNm varchar(30)
)
begin
insert into PdfEntry
(BatchName,ClientNm) values
 (BatchName,ClientNm);
end#
delimiter ;

c# code :
C#
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();
        }
Posted
Updated 23-Aug-11 19:57pm
v3
Comments
Simon Bang Terkildsen 24-Aug-11 1:55am    
Can you provide your stored procedure, please?
anjali2 24-Aug-11 2:08am    
I am already provided stored procedure.
walterhevedeich 24-Aug-11 2:24am    
Not sure if it matters, but have you tried putting a space between end and the # sign?

hi
please use this lnik i think this will help you
www.mysqltutorial.org/stored-procedures-parameters.aspx[^]
 
Share this answer
 
v2
 
Share this answer
 
Comments
CHill60 19-May-15 19:26pm    
You're over 3 years late with nothing but a link that probably wouldn't have helped anyway. I would advise not doing more of this in future - you will note that you already have several members downvoting this solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900