Adding blank entries to database

Results 1 to 2 of 2

Thread: Adding blank entries to database

  1. #1
    Join Date
    Dec 1969

    Default Adding blank entries to database

    I track who logs on to my website by using session variables. I write the info to an access database. For some reason, some entries are being recorded as blank. Any ideas please?<BR><BR>&#039;-----Validates UserID and Password-----&#039;<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR><BR>objC onn.Open Session("ConnectString")<BR>strSQL = "SELECT * FROM Table WHERE UserName = &#039;" &user& "&#039; and Password = &#039;" &pass& "&#039;"<BR>set objRS = objConn.Execute(strSQL)<BR><BR>if NOT objRS.EOF Then<BR> Session("ValidUser") = 1<BR> Session("Username") = User<BR> Session("Password") = Pass<BR> Session("Agency") = objRS("ShipAgency")<BR> Session("Email") = objRS("Email")<BR> Session("Windows") = objRS("Windows")<BR><BR> If Session("Windows") = "1" then<BR> objRS.Close<BR> set objRS = Nothing<BR> objConn.Close<BR> set objConn = Nothing<BR> response.redirect "QQWRedirect.asp"<BR> Else<BR> objRS.Close<BR> set objRS = Nothing<BR> objConn.Close<BR> set objConn = Nothing<BR> response.redirect "Select.asp"<BR> End If<BR>End If<BR>&#039;---------------------------------------&#039;<BR><BR>&#039;-----Inserts Username, Agency Name, Email and Status into database-----&#039;<BR>dim objConn, objRS, strID, strConnect<BR>strConnect = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("/database/Database.mdb")<BR>set objConn = Server.Createobject("ADODB.Connection")<BR>objConn .open strConnect<BR>set objRS = Server.Createobject("ADODB.Recordset")<BR>objRS.op en "Table", strConnect, 2, 2<BR>objRS.addnew<BR><BR>objRS("Username") = Session("Username")<BR>objRS("Agency") = Session("Agency")<BR>objRS("Email") = Session("Email")<BR>objRS("Date") = FormatDateTime(Date)<BR>objRS("Time") = FormatDateTime(Now, 3)<BR><BR>objRS.update<BR>objRS.movelast<BR>objRS. close<BR>objConn.close<BR>set objRS= nothing<BR>set objConn = nothing<BR>&#039;------------------------------------------------------------------------&#039;

  2. #2
    Join Date
    Dec 1969

    Default RE: Adding blank entries to database

    When you say that you are getting blank records does that mean that all of the information is blank or just UserName, Agency or Email? If Date and Time are filled but the rest are empty it means that you are not getting an objrs.eof above and are not putting info into the session variable.<BR><BR>If all of the information for all fields is blank then is another issue.<BR><BR>Hope this helps

Posting Permissions

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