sql server - Log-in condition in Visual Basic -
so have code , i'm having hard time giving admin privileges.
in database have boolean value is user admin. want write sql statement checks if person admin , use different form if person user. i'm new @ stuff - how go doing (with have checks if information i'm trying log-on user , take me new form)
try con.connectionstring = "***" con.open() cmd.connection = con cmd.commandtext = "select username, pword users" _ & " (username = '" & txtusername.text _ & "') , (pword = '" & txtpassword.text & "')" dim lrd sqldatareader = cmd.executereader() if lrd.hasrows lrd.read() password = lrd("pword").tostring() username = lrd("username").tostring() password2 = txtpassword.text() ' if passowrd = passowrd2 , username = txtusername.text then' messagebox.show("logged in " & username, "", messageboxbuttons.ok, messageboxicon.information) form2.show() me.hide() 'clear fields' txtpassword.text = "" txtusername.text = "" ' end if' 'end while' else messagebox.show("username , password not match..", "authentication failure", messageboxbuttons.ok, messageboxicon.exclamation) 'clear fields' txtpassword.text = "" txtusername.text = "" end if 'end if' catch ex exception messagebox.show("error while connecting sql server." & ex.message) con.close() 'whether there error or not. close connection.' end try
Comments
Post a Comment