Calling a stored procedured in C# : CSharp : Procedure Function SQL / MySQL


SQL / MySQL » Procedure Function » CSharp »

 

Calling a stored procedured in C#


 
MySqlConnection myConnection;        
myConnection = new MySqlConnection();
myConnection.ConnectionString = "database="+database+";server="+server+";user id="+user+";Password="+password;
try  {
    myConnection.Open();
}
catch (MySqlException MyException)            {
    Console.WriteLine("Connection error: MySQL code: "+MyException.Number
                     +" "+ MyException.Message);
}

try {
            
   MySqlCommand myCommand = new MySqlCommand("call error_test_proc(1)",
                                              myConnection);            
   myCommand.ExecuteNonQuery();
}
catch (MySqlException MyException)            {
   Console.WriteLine("Stored procedure error: MySQL code: " + MyException.Number
                     "  " + MyException.Message);
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

SQL / MySQL

 Navioo Procedure Function
» CSharp