Comparing a submitted form value with database rec

Results 1 to 2 of 2

Thread: Comparing a submitted form value with database rec

  1. #1
    Join Date
    Dec 1969

    Default Comparing a submitted form value with database rec

    I&#039;m new to .net, Can anyone tell me what is wrong with the following string. I&#039;m trying to create a login by comparing with a database store password:<BR>(Error Message: Exception Details: System.FormatException: Input string was not in a correct format.) <BR>
    <BR><BR> Dim LPass = LoginDS.Tables("LoginTab").Rows("Password")<BR> <BR> 	If request.Form("Password") Is LPass<BR>
    <BR><BR>Here&#039;s the full code (the main bit of it anyway):<BR>[code]<BR>Response.end<BR>else If Request.Form("LoginForm") = "true" then<BR> Dim Connect As OleDbConnection = New OleDbConnection<BR> Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter<BR> Dim ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("..dbdata.mdb")<BR> Connect.ConnectionString = ConnectString<BR> Adapter.SelectCommand = new OleDbCommand("SELECT Password FROM LoginTab WHERE Username = &#039;"& Request.Form("Username")&"&#039; ", Connect)<BR> Adapter.SelectCommand.Connection.Open<BR> <BR> Dim LoginDS As DataSet = New DataSet<BR> Adapter.Fill(LoginDS, "LoginTab")<BR> <BR> <BR> <BR> if(LoginDS.Tables("LoginTab").Rows.Count = 0) Then<BR>%&#062;<BR>&#060;html&#062;<BR>&#060;h2&#0 62;Login Failure&#060;/h2&#062;<BR>Incorrect Username or Password &#060;br /&#062;<BR>&#060;a href="default.asp"&#062;Try Again&#060;/a&#062;<BR>&#060;/html&#062;<BR>&#060;%<BR>response.End<BR>Else<BR>D im LPass = LoginDS.Tables("LoginTab").Rows("Password")<BR>Res ponse.write (LPass)<BR> If request.Form("Password") Is LPass then<BR> Session("AdminAuth") = "Authorised"<BR> Session("Username") = Request.Form("Username")<BR> response.redirect ("default.aspx")<BR> else<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Comparing a submitted form value with database

    Dim LPass = LoginDS.Tables("LoginTab").Rows("Password") <BR>This line should be<BR>Dim LPass = LoginDS.Tables("LoginTab").Rows(0)("Password") <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts