[RESOLVED] logon only if enabled
hi there,
my login was working fine with only using the 2 fileds user name and password
my login page uses my companydb.aspx code file to process the logins
basically i want to upgrade the login if you like
before it was
username password correct then come on in
if not correct stay out
now i want
if username password and comp_enabled = 1
then come on in
CompanyDB code
VB Code:
Public Shared Function ValidateUser(ByVal UserName As String, ByVal Password As String, [COLOR=RoyalBlue]ByVal enabled As String[/COLOR]) _
As Boolean
Dim sSelect As String
sSelect = "SELECT COUNT(*) FROM tb_comp_detail " _
& "WHERE c_companycode = '" & UserName _
& "' AND c_password = '" & Password & "'" _
[COLOR=RoyalBlue]& "' AND c_comp_enabled = '" & enabled & "'"[/COLOR]
Dim cmdSelect As New SqlCommand(sSelect, Connection)
Dim iCount As Integer
cmdSelect.Connection.Open()
iCount = cmdSelect.ExecuteScalar()
cmdSelect.Connection.Close()
my login page
VB Code:
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
If companyDB.ValidateUser(txtUsername.Text, txtPassword.Text, [COLOR=RoyalBlue]lblOn.Text[/COLOR]) Then
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, chkAutomatic.Checked)
Else
changes i made above are in blue
the lblon is just a label text 1 in it
the error i get is incorrect syntax near 1
Re: logon only if enabled
You have two ' characters after Password (one on each of the last two lines), you should only have one of them.