Ask a Question related to Dreamweaver AppDev, Design and Development.
-
btn #1
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
-
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.... -
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... -
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.... -
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... -
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... -
CarlGrint #2
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



Reply With Quote

