VB.net to MySql Stored Procedure Error

前端 未结 1 1369
感动是毒
感动是毒 2021-01-27 05:19

I\'m a total newb to stored procedures, so I may be missing something easy, but I researched the basics and I\'m stuck trying to integrate it from vb.net code. I created a simpl

相关标签:
1条回答
  • 2021-01-27 05:45

    You might try changing to a direct call (I haven't tested this:

     cmd.CommandType = CommandType.Text
     cmd.CommandText = "CALL GetRuntestToday"
    

    Also, a better way of writing your code:

    Dim MyConString As String = "My String Details"
    Using dbcRuntest As New OdbcConnection(MyConString)
      dbcRuntest.Open()
      Using cmd As New OdbcCommand("CALL GetRuntestToday", dbcRuntest)
        cmd.CommandType = CommandType.Text
        Using reader As OdbcDataReader = cmd.ExecuteReader
          'do someting with reader'
        End Using
      End Using 
    End Using
    

    The Using structure automatically closes the connection and disposes it (along with the other objects).

    Edited to use CALL instead of EXECUTE

    0 讨论(0)
提交回复
热议问题