Greetings,
I'm trying to convert an application over to the Data Access application block and I'm getting stuck :(
Below is the code I'm trying to use. Everything worked properly before I started to convert it over. Any pointers would be greatly appreciated
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
If Page.IsValid Then
Try
'Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings("connStr"))
'Dim cmd As New SqlCommand("CheckLogin", Conn)
'cmd.CommandType = CommandType.StoredProcedure
Dim Param(1) As SqlParameter
Dim strCryptPass As String
Dim intResult As Integer
Param(0) = New SqlParameter("@username", SqlDbType.VarChar)
Param(0).Value = Replace(txtUsername.Text, "'", "''")
'cmd.Parameters.Add(Param)
strCryptPass = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.ToLower, "sha1")
Param(1) = New SqlParameter("@password", SqlDbType.VarChar)
Param(1).Value = strCryptPass
'cmd.Parameters.Add(Param)
'Conn.Open()
'cmd.ExecuteNonQuery()
'intResult = cmd.Parameters("@RETURN_VALUE").Value
'Conn.Close()
intResult = Convert.ToInt32(SqlHelper.ExecuteScalar(ConfigurationSettings.AppSettings("connStr"), CommandType.StoredProcedure, "CheckLogin", Param))
Select Case intResult
Case Is > 0
CreateTicket(txtUsername.Text, intResult)
Case -1
lblErr.Text = "Username could not be found"
Case -2
lblErr.Text = "Passwords do not match"
End Select
Catch ex As Exception
lblErr.Text = ex.Message
End Try
End If
End Sub