I have a stored procedure with 2 parameters and which returns result is a PRINT message. I can pass the parameters in and run the stored procedure but I can't figure out how to return the result.
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class Form1
Dim SQL As New SQLControl
Dim cmd As New SqlCommand
Private Sub RunSql_Click(sender As System.Object, e As System.EventArgs) Handles RunSql.Click
Try
If SQL.HasConnection = True Then
SQL.SQLCon.Open()
cmd.Connection = SQL.SQLCon
cmd.CommandText = "Exec stored procedure " & param1.Text & "," & param2.Text
cmd.ExecuteNonQuery()
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
SQL.SQLCon.Close()
End Try
End Sub
End Class
Thanks in advance.