Check new username on Update record??

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Check new username on Update record??

    Hi - using ASP/Access/Vbscript.

    How can I use the "check new username" behaviour in DW on UPDATE RECORD?
    DW tells me that it needs an insert record behaviour for this?

    Need to be sure that there is no double usernames in the DB. (User is allowed
    to update account)
    Username= email adress, and this can often change...

    Any suggestions?

    Bjorn.Text

    btn Guest

  2. Similar Questions and Discussions

    1. Check if username exist alternative..? please help
      Hi - using ASP/Access/Vbscript Want to use a alternative of the DW check if username exist behaviour. I have a insert record form on my page....
    2. Check username to see if already used
      I know this is an easy script. I used to know it actually, but forget it. Before updating my DB with the new entry... i want it to check the...
    3. using dropdown box to display db record & update record
      Hi Folks, I have a web database written in asp and using access97. I have many projects, but each project is being held responsible by a person....
    4. Update existing From record with changes on new To record
      I need to create a history record and update a current record from one input form. The two tables are joined with a query and the table names and...
    5. Check for locked record
      How can i check if the record i want to select is already locked by another user? There is a way to know the resource id associated with the record...
  3. #2

    Default Re: Check new username on Update record??

    The inbuilt behaviour uses code which checks for the Insert behaviour, but you
    can tweak it to run with the Update behaviour.

    The basic code looks like

    <%
    ' *** Redirect if username exists
    MM_flag="MM_insert"
    If (CStr(Request(MM_flag)) <> "") Then
    MM_dupKeyRedirect="sorry.asp"
    MM_rsKeyConnection=MM_connection_STRING
    MM_dupKeyUsernameValue = CStr(Request.Form("txtRegUsername"))
    MM_dupKeySQL="SELECT CustomerUsername FROM Customers WHERE
    CustomerUsername='" & MM_dupKeyUsernameValue & "'"
    MM_adodbRecordset="ADODB.Recordset"
    set MM_rsKey=Server.CreateObject(MM_adodbRecordset)
    MM_rsKey.ActiveConnection=MM_rsKeyConnection
    MM_rsKey.Source=MM_dupKeySQL
    MM_rsKey.CursorType=0
    MM_rsKey.CursorLocation=2
    MM_rsKey.LockType=3
    MM_rsKey.Open
    If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
    ' the username was found - can not add the requested username
    MM_qsChar = "?"
    If (InStr(1,MM_dupKeyRedirect,"?") >= 1) Then MM_qsChar = "&"
    MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" &
    MM_dupKeyUsernameValue
    Response.Redirect(MM_dupKeyRedirect)
    End If
    MM_rsKey.Close
    End If
    %>

    This code
    MM_flag="MM_insert"
    If (CStr(Request(MM_flag)) <> "") Then

    Is the one which looks for the standard hidden field Dreamweaver uses for
    setting an Insert, it does the same for an Update, just with a different name,
    so you change

    MM_flag="MM_insert"
    to
    MM_flag="MM_update"

    and the code will work with your Update, the Server behaviour will have a !
    next to it, as it does not like it, but will work perfectly fine.


    Originally posted by: btn
    Hi - using ASP/Access/Vbscript.

    How can I use the "check new username" behaviour in DW on UPDATE RECORD?
    DW tells me that it needs an insert record behaviour for this?

    Need to be sure that there is no double usernames in the DB. (User is allowed
    to update account)
    Username= email adress, and this can often change...

    Any suggestions?

    Bjorn.Text



    CarlGrint Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139