Creating Procedure From C# in MYSQL?
Posted by: Majid Bhutta
Date: August 25, 2006 12:42AM

Hi Dears!

I am trying to create a database in MYSQL 5.1 using Connector/Net 5.0.0.0 in C#.
Everything is going fine but when i try to create procedure , i get error
#42000 You have an error in your sql syntax. i tried other alternative too but have been unable to create a stored procedure in mysql by running script from c#. My database script runs fine when executed from MYSQL command prompt. It creates database, tables ,views and procedures too. But when i run it from C# it creates all other things except the procedures. on create Procedure line it generates the above mentioned error. Whats the matter. How to solve it.
Below is C# code Snipt that I am using;

MySqlConnection mySqlCon;
MySqlCommand myCmd;

mySqlCon = new MySqlConnection("Data Source= localhost;DataBase=mysql;uid=root;pwd=mypsqwd");
mySqlCon.Open();
if (mySqlCon.State == ConnectionState.Open)
{
MessageBox.Show("Connection Opened");

}


Script myScript =new Script();
myCmd = new MySqlCommand(myScript.SQL.ToString(), mySqlCon);
myCmd.ExecuteNonQuery();
MessageBox.Show("Db Created");
mySqlCon.Close();



}
Script.SQL contains StringBuilder which has all of my Script.
Please i nee guidance in this regard how to create procedure from C#.

Options: ReplyQuote


Subject
Written By
Posted
Creating Procedure From C# in MYSQL?
August 25, 2006 12:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.