开发者

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

开发者 https://www.devze.com 2022-11-30 14:33 出处:网络 作者: 鉴客
这篇文章主要介绍了VB.NET调用MySQL存储过程并获得返回值的方法,涉及基于VB.NET操作MySQL数据库的相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了VB.NET调用mysql存储过程并获得返回值的方法。分享给大家供大家参考。具体实现方开发者_JS开发法如下:

Dim myConnectionString As String = "Database=" & myDatabase & _
   " ;Data Source=" & myHost & _
  编程客栈 ";User Id=" & myUserId & ";Password=www.devze.com" & myPassword
Dim myConnection As New MySqlConnection(myConnectionString)
Try
  myConnection.Open()
Catch MyException As MySqlExc编程客栈eption
  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.WriteLin编程客栈e("Stored procedure error: MySQL code: " & _
      MyException.Number & " " & _
      MyException.Message)
End Try

希望本文所编程客栈述对大家的VB.NET程序设计有所帮助。

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号