Я продолжаю получать эту ошибку:
Параметрированный запрос '(@AdminEmail nvarchar (4000), @AdminPassword nvarchar (4000)) SELECT 'ожидает параметр' @AdminEmail ', который был не прилагается.
код:
Public Function AuthenticateAdmin() As Boolean
Dim Success As Boolean
Dim strConn As String
strConn = ConfigurationManager.ConnectionStrings("HMVDb").ToString
Dim conn As New SqlConnection(strConn.ToString())
Dim cmd As New SqlCommand("SELECT * FROM Admin WHERE [email protected] AND [email protected]", conn)
cmd.Parameters.AddWithValue("@AdminEmail", EMail)
cmd.Parameters.AddWithValue("@AdminPassword", Password)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
conn.Open()
da.Fill(ds, "Admin")
conn.Close()
If ds.Tables("Admin").Rows.Count > 0 Then
Dim aemail As String = ds.Tables("Admin").Rows(0).Item("AdminEmail")
Dim apass As String = ds.Tables("Admin").Rows(0).Item("AdminPassword")
Dim aid As Integer = ds.Tables("Admin").Rows(0).Item("AdminID")
Dim aname As String = ds.Tables("Admin").Rows(0).Item("AdminName")
If EMail = aemail And Password = apass Then
ID = aid ' Shopper ID that identify Ecader
Name = aname
Success = True 'Shopper is authenticated
Else
Success = False 'Authentication fail
End If
End If
'Return the authentication result to calling program
Return Success
End Function