View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How can I check if a record exists before inserting

Thread began 5/05/2009 8:40 am by doggyDivemaster | Last modified 6/03/2009 3:12 pm by doggyDivemaster | 6496 views | 25 replies

doggyDivemaster

Thanks, I needed to check whether there was a built-in DataAssist behaviour but as there wasn't, I have followed your advice.

Because I was ALSO inserting the filename from a file uploaded by WA DigitalFilePro, I had to modify the Check New User Name code.

Here it is for anyone else reading this post. I have commented out the Dreanweaver lines I had to modify.

' *** Redirect if username exists
'MM_flag = "MM_insert" ***** Removed
'If (CStr(Request(MM_flag)) <> "") Then *****Replaced code with the line below
if (cStr(WA_DFP_UploadObj.Form("Insert.x")) <> "") Then
Dim MM_rsKey
Dim MM_rsKey_cmd

MM_dupKeyRedirect = "index.asp"
'MM_dupKeyUsernameValue = CStr(Request.Form("jobDescription")) *****Replaced code with the line below
MM_dupKeyUsernameValue = cStr(WA_DFP_UploadObj.Form("jobDescription"))
Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
MM_rsKey_cmd.ActiveConnection = MM_printShop_STRING
MM_rsKey_cmd.CommandText = "SELECT jobDescription FROM jobDescriptions WHERE jobDescription = ?"
MM_rsKey_cmd.Prepared = true
MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 50, MM_dupKeyUsernameValue) ' adVarChar
Set MM_rsKey = MM_rsKey_cmd.Execute
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
%>


SUGGESTION - You should add this invaluable behaviour to DataAssist

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...