45fan.com - 路饭网

搜索: 您的位置主页 > 电脑频道 > 编程代码 > 阅读资讯:VB.NET编程如何调用MySQL的存储过程并获得返回值?

VB.NET编程如何调用MySQL的存储过程并获得返回值?

2015-08-06 16:35:34 来源:www.45fan.com 【

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程序设计有所帮助。


本文地址:http://www.45fan.com/bcdm/16980.html
Tags: mysql 存储 VB.NET
编辑:路饭网
推广内容
推荐阅读
热门推荐
推荐文章
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部