Inserting Data Into Access Database & More

Results 1 to 4 of 4

Thread: Inserting Data Into Access Database & More

  1. #1
    J.A.S. Guest

    Default Inserting Data Into Access Database & More

    I have the ODBC DSN connection established. I have two Form fields on my asp page, one named "fusername" and one "fpasswod". I want to insert the value from the "fpassword" form field into a database field called "password" in a table called "Users" WHERE "fusername" is equal the the database field "username". But here is the catch, and where I am stuck. If the value in the database field "password" is not empty or null for the corresponding "username" field I would like the the user to be re-directed to a page entitled "alreadyestablished.asp"; otherwise, if the value is null for the "password" field I would like the form field value for "fpassword" to be inserted into "password" and have the user sent to a page entitled "confirmation.asp" (which is the page listed as the "action" for the form). Can you help? Thanks.

  2. #2
    Shawn Clabough Guest

    Default RE: Inserting Data Into Access Database & More

    As long as you haven&#039t written anything out to the page, you may do your logic and insert a record into a table and then redirect to the necessary page.<BR><BR>&#060;%<BR>if password matches user then<BR> response.redirect "alreadyestablished.asp"<BR>else<BR> insert password into table<BR> response.redirect "confirmation.asp"<BR>end if <BR>%&#062;

  3. #3
    Stephen Fisher Guest

    Default RE: Inserting Data Into Access Database & More

    strSQL = "Select * from Users Where Username = &#039" & fUsername<BR>rs.CursorLocation = adUseServer<BR>rs.CursorType = adOpenStatic<BR>rs.LockType = adLockOptimistic<BR>rs.Open strSQL, cnConnection<BR><BR>If rs("Password") = "" or IsNull(rs("Password")) Then<BR> rs("Password") = fPassword<BR> rs.Update &#039 or response.redirect "confirmation.asp"<BR>Else<BR> response.redirect "alreadyestablished.asp"<BR>End If

  4. #4
    J.A.S. Guest

    Default RE: Inserting Data Into Access Database & More

    Stephen,<BR>Thanks a million. Your a life saver!


Posting Permissions

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