Robert,
Excellent article. I have found many uses for the SQL Output but have one small problem.
Can anyone point me toward some example code that shows how to gather the output data when using VB.NET with late-binding in web applications. I use stored procs like crazy to return datasets but can't figure out how to get the OUTPUT items back into my program so I can do something with them. In the example below I would really like to just have the SP return an Output value of "true" or "false" and do away with all the extra check to see if a record came back or not.
Thanks.
John at Free Design
Public Function CheckUserLogin(ByVal vLoginName As String) As Boolean
Dim oSqlConn As Data.SqlClient.SqlConnection = SqlConnection()
Try
Dim oSqlCmdList As Data.SqlClient.SqlCommand = New Data.SqlClient.SqlCommand("CheckUserLogin", oSqlConn)
oSqlCmdList.CommandType = Data.CommandType.StoredProcedure
Dim oSqlParm1 As New Data.SqlClient.SqlParameter("@UserLogin", vLoginName)
oSqlCmdList.Parameters.Add(oSqlParm1)
oSqlConn.Open()
Dim oSQLDataAdapter As Data.SqlClient.SqlDataAdapter = New Data.SqlClient.SqlDataAdapter
Dim oDataSet As Data.DataSet = New Data.DataSet
oSQLDataAdapter.SelectCommand = oSqlCmdList
oSQLDataAdapter.Fill(oDataSet, "ProcData")
'This checks for the existence of a login name
If oDataSet.Tables("ProcData") Is DBNull.Value Then
Return False
Else
Dim oDataView As Data.DataView = oDataSet.Tables("ProcData").DefaultView
If oDataView.Count <= 0 Then
Return False
Else
Return True
End If
End If
Catch oErr As Exception
WriteActivityLog(0, "SQL Error", "CheckUserLogin", oErr.Message)
SendErrorEmail("Help@MyFreeDesign.com", "SQLProc-NTO CheckUserlogin", oErr.Message)
Return False
Finally
If oSqlConn.State = Data.ConnectionState.Open Then
oSqlConn.Close()
End If
End Try
End Function