本文实例讲述了VB.NET调用MySQL存储过程并获得返回值的方法。分享给大家供大家参考。具体实现方法如下:
Dim myConnectionString As String = "Database=" & myDatabase & _
" ;Data Source=" & myHost & _
";User Id=" & myUserId & ";Password=" & myPassword
Dim myConnection As New MySqlConnection(myConnectionString)
Try
myConnection.Open()
Catch MyException As MySqlException
Console.WriteLine("Connection error: MySQL code: " & MyException.Number & _
" " + MyException.Message)
End Try
Try
Dim myCommand As New MySqlCommand("call error_test_proc(1)")
myCommand.Connection = myConnection
myCommand.ExecuteNonQuery()
Catch MyException As MySqlException
Console.WriteLine("Stored procedure error: MySQL code: " & _
MyException.Number & " " & _
MyException.Message)
End Try
希望本文所述对大家的VB.NET程序设计有所帮助。
您可能感兴趣的文章:mysql 存储过程中变量的定义与赋值操作mysql存储过程 在动态SQL内获取返回值的方法详解PHP调用MySQL存储过程并返回值的方法Java调用MySQL存储过程并获得返回值的方法Python简单调用MySQL存储过程并获得返回值的方法Mysql带返回值与不带返回值的2种存储过程写法mysql存储过程之创建(CREATE PROCEDURE)和调用(CALL)及变量创建(DECLARE)和赋值(SET)操作方法mysql存储过程之引发存储过程中的错误条件(SIGNAL和RESIGNAL语句)实例分析mysql存储过程之错误处理实例详解mysql存储过程之返回多个值的方法示例