asp.net - Conversion from string "" to type 'Boolean' is not valid -
i getting error message in title on login form in asp.net know how can sort out? appreciated
protected sub button1_click(byval sender object, byval e eventargs) handles button1.click dim conn new mysqlconnection conn.connectionstring = ("server=localhost;port=3307;user=user;password=password;database=db;") try dim sql string = "select * users3 uname = '" & txtuname.text & "' , password = '" & txtpwd.text & "'" conn.open() dim cmd new mysqlcommand(sql, conn) dim reader mysqldatareader = cmd.executereader reader.read() dim isvalidlogin boolean boolean.tryparse(reader.getvalue(1), isvalidlogin) if isvalidlogin session("username") = txtuname.text response.redirect("registerprop.aspx") else response.write("invalid login") end if catch ex exception response.write("an error occurred: " & ex.message.tostring()) end try end sub
change:
dim isvalidlogin = reader.getvalue(1)
to:
dim isvalidlogin boolean boolean.tryparse(reader.getvalue(1), isvalidlogin)
Comments
Post a Comment