VB.NET调用MySQL存储过程并获得返回值的方法
本文实例讲述了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程序设计有所帮助。
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11