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 | 6286 views | 25 replies

Ray BorduinWebAssist

OK, I'm not sure of the problem, so lets try a different aproach.

Lets try removing all the recordcount stuff and do something like:

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("Title") <> "") Then
Recordset1__MMColParam = Request.QueryString("Title")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_hostspaced_STRING
Recordset1_cmd.CommandText = "SELECT Count(Title) AS TitleCount FROM software WHERE Title = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 255, Recordset1__MMColParam) ' adVarChar

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

<%
if (Request.ServerVariables("Request_Method") = "POST") then
WAFV_Redirect = ""
Session("WAVT_insertproduct_Errors") = ""
if (WAFV_Redirect = "") then
WAFV_Redirect = cStr(Request.ServerVariables("SCRIPT_NAME"))
end if
WAFV_Errors = ""
WAFV_Errors = WAFV_Errors & WAValidateNM((Recordset1.fields("TitleCount")) & "",0,0,"",",.",true,1)

if (WAFV_Errors<> "") then
PostResult WAFV_Redirect,WAFV_Errors,"insertproduct"
end if
end if
%>

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...