Create Stored Procedure with vb.net

You are viewing an old version of this question. View the current version here.

I try to create a stored procedure with vb.net and MySqlConnector. When running the script in Mariadb it runs well.

DELIMITER CREATE DEFINER=`root`@`localhost` PROCEDURE IF NOT EXISTS

Coding

END //

When I run it in vb.net, I get the following error.

MySqlConnector.MySqlException: ''DELIMITER' should not be used with MySqlConnector. See https://fl.vu/mysql-delimiter' Inner exeption MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER CREATE DEFINER=`root`@`localhos...' at line 1

I Tried also with DILIMITER $$ and without DILIMITER, but that is not exepted by Mariadb. How can I solve my error.

Answer

To solve this problem the type of the CMD can be put as text. So Delimiter is not needed.

Dim cmd As New MySqlCommand() cmd.connection = MysqlConn cmd.commandtype = CommandType.Text cmd.CommandText = Query cmd.ExecuteNonQuery()

Thx for the fast and very good explanation of mr. T.B. of Mariadb

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.