MySqlCommand cmd = new MySqlCommand("sp_data", connection);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
MySqlDataReader rdrdata = cmd.ExecuteReader();
error : Procedure or function 'sp_data
' cannot be found in database
Create a simple stored procedure. DELIMITER ; To create the MySQL Stored Procedure, open the MySQL workbench Connect to the MySQL Database copy-paste the code in the query editor window click on Execute. You can view the procedure under stored procedures.
A procedure does not return a value. Instead, it is invoked with a CALL statement to perform an operation such as modifying a table or processing retrieved records. On the other hand, a function is invoked within an expression and returns a single value directly to the caller to be used in the expression.
MySQL handler precedence In case you have multiple handlers that handle the same error, MySQL will call the most specific handler to handle the error first based on the following rules: An error always maps to a MySQL error code because in MySQL it is the most specific.
Just ensure that you have set your DB name in your connection string in lower case.
Found that my database was in upper case in the connection string but the Actual name was in the lower case. corrected this and worked perfect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With