欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VB.NET调用MySQL存储过程并获得返回值的方法

程序员文章站 2023-12-21 20:56:28
本文实例讲述了vb.net调用mysql存储过程并获得返回值的方法。分享给大家供大家参考。具体实现方法如下: dim myconnectionstring as...

本文实例讲述了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程序设计有所帮助。

上一篇:

下一篇: