I am having trouble with the following procedure. The stored procedure executes as expected but when executed through VB returns 0 even when I hard code the parameters.
VB code:
Dim s As String = "Data Source=MIS-PC-284\SQLEXPRESS;Initial Catalog=matrix;Integrated Security=True"
Dim cnn As New SqlConnection(s)
Dim cmd As New SqlCommand
Dim iRet As Integer
cnn.Open()
cmd.Connection = cnn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "User_Validation"
cmd.Parameters.AddWithValue("@USERNAME", txtUserName.Text.Trim)
cmd.Parameters.AddWithValue("@PASSWORD", txtPassword.Text.Trim)
iRet = Convert.ToInt16(cmd.ExecuteScalar())
If iRet = 1 Then MsgBox("welcome back, " & txtUserName.Text)
stored procedure:
ALTER PROCEDURE [dbo].[User_Validation]
(
@USERN ...
Go to the complete details ...