亲宝软件园·资讯

展开

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

鉴客 人气:0
想了解VB.NET调用MySQL存储过程并获得返回值的方法的相关内容吗,鉴客在本文为您仔细讲解VB.NET调用MySQL存储过程并获得返回值的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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程序设计有所帮助。

加载全部内容

相关教程
猜你喜欢
用户评论