Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error procedure or function mysql not found

Tags:

c#

mysql

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

like image 961
bessie Avatar asked Aug 20 '11 09:08

bessie


People also ask

How to create MySQL procedure?

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.

What is procedure and function in MySQL?

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.

How to handle errors in MySQL?

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.


2 Answers

Just ensure that you have set your DB name in your connection string in lower case.

like image 192
Farshid Avatar answered Sep 26 '22 16:09

Farshid


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

like image 29
Maganjo Avatar answered Sep 25 '22 16:09

Maganjo