Forums
This topic is locked
ASP Command Variables in Dreamweaver 8.0.2
Posted 25 Nov 2006 14:03:50
1
has voted
25 Nov 2006 14:03:50 bill charrette posted:
In the Dreamweaver 8.0.2 Updater, changes were made to the ASP code that Dreamweaver generates. One specific change is to the ASP Command server behaviors. When you fill out the Command dialog box, Dreamweaver 8.0.2 now asks you to provide the “Type” and “Size” for the variables without any hinting or drop-down menus, so you have to know what to type in these fields. You can find all the details at the following links:
www.adobe.com/cfusion/knowledgebase/index.cfm?id=4e6b330a
msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcstdatatypeenum.asp
Anyway...
I have built a web application (using Dreamweaver 8.0.2, ASP VBScript and MS Access 2000 database). I have a field in one of the tables named IssueReadCount (Data Type: Number; Field Size: Long Integer). This field stores the number of times the page is read.
I added an ‘UPDATE’ ASP Command Server Behavior to the page as follows:
UPDATE tblIssues
SET IssueReadCount = IssueReadCount + 1
WHERE IssueID = MMColParam
MMColParam = Request.QueryString ("iss_id"
'Type' variable: Double (Numeric data type for MS Access, MS SQL, MySQL)
'Size' variable: -1 (Numeric, Boolean and Date/Time data types always use -1 as the size)
Dreamweaver resulting code looks like:
<% ' this is to increment the IssueReadCount in tblIssues table
Set cmdIssueReadCount = Server.CreateObject ("ADODB.Command"
cmdIssueReadCount.ActiveConnection = MM_connIssuesManager_STRING
cmdIssueReadCount.CommandText = "UPDATE tblIssues SET IssueReadCount = IssueReadCount + 1 WHERE IssueID = ? "
cmdIssueReadCount.Parameters.Append cmdIssueReadCount.CreateParameter("MMColParam", 5, 1, -1, MM_IIF(Request.QueryString("iss_id", Request.QueryString("iss_id", cmdIssueReadCount__MMColParam & "")
cmdIssueReadCount.CommandType = 1
cmdIssueReadCount.CommandTimeout = 0
cmdIssueReadCount.Prepared = true
cmdIssueReadCount.Execute()
%>
My problem is that every time the page is read the IssueReadCount is incremented by 2 (not 1 as I need).
I’ve tried just about everything I can think of and can’t get it to increment by 1. Does anyone have an idea what I’m doing wrong? Any suggestion will help.
Bill
Replies
Replied 07 Apr 2009 13:43:52
07 Apr 2009 13:43:52 David Breschi replied:
Hi everyone, insteads open a new thread i resume this to solve my problem...
i use the update command on DW CS3 and ASP using VbScript but doesn't work i don't know why...
i have called this command as "ContaClick".
In my page i have 2 Recordset, one that filters parameter "idCat" form tab Categorie and one that filter parameter "idArt" from tab Articoli.
I have "Hit" field whom have to be update by the command
the code doesn't work cause che command doesn't update my Access DB...
this is my code
There is anyone who can help me????
i use the update command on DW CS3 and ASP using VbScript but doesn't work i don't know why...
i have called this command as "ContaClick".
In my page i have 2 Recordset, one that filters parameter "idCat" form tab Categorie and one that filter parameter "idArt" from tab Articoli.
I have "Hit" field whom have to be update by the command
the code doesn't work cause che command doesn't update my Access DB...
this is my code
<%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/dbCatalogo.asp" --> < %' IIf implementation Function MM_IIf(condition, ifTrue, ifFalse) If condition = "" Then MM_IIf = ifFalse Else MM_IIf = ifTrue End If End Function %> < %Dim rsCategoria Dim rsCategoria_cmd Dim rsCategoria_numRows Set rsCategoria_cmd = Server.CreateObject ("ADODB.Command") rsCategoria_cmd.ActiveConnection = MM_dbCatalogo_STRING rsCategoria_cmd.CommandText = "SELECT idCat, categoria FROM categorie ORDER BY categoria ASC" rsCategoria_cmd.Prepared = true Set rsCategoria = rsCategoria_cmd.Execute rsCategoria_numRows = 0 %> < %Dim rsCatalogo__MMColParam rsCatalogo__MMColParam = "1" If (Request.QueryString("idCat") <> "") Then rsCatalogo__MMColParam = Request.QueryString("idCat") End If %> < %Dim rsCatalogo Dim rsCatalogo_cmd Dim rsCatalogo_numRows Set rsCatalogo_cmd = Server.CreateObject ("ADODB.Command") rsCatalogo_cmd.ActiveConnection = MM_dbCatalogo_STRING rsCatalogo_cmd.CommandText = "SELECT * FROM articoli WHERE idCat = ? ORDER BY descrizione ASC" rsCatalogo_cmd.Prepared = true rsCatalogo_cmd.Parameters.Append rsCatalogo_cmd.CreateParameter("param1", 5, 1, -1, rsCatalogo__MMColParam) ' adDouble Set rsCatalogo = rsCatalogo_cmd.Execute rsCatalogo_numRows = 0 %> < %Dim rsProdotto__MMColParam rsProdotto__MMColParam = "1" If (Request.QueryString("idArt") <> "") Then rsProdotto__MMColParam = Request.QueryString("idArt") End If %> < %Dim rsProdotto Dim rsProdotto_cmd Dim rsProdotto_numRows Set rsProdotto_cmd = Server.CreateObject ("ADODB.Command") rsProdotto_cmd.ActiveConnection = MM_dbCatalogo_STRING rsProdotto_cmd.CommandText = "SELECT articoli.idArt, articoli.codice, articoli.descrizione, articoli.misure, articoli.imballaggio, articoli.prezzo, articoli.immagine, articoli.idCat, categorie.idCat, categorie.categoria, articoli.dettagli, articoli.colori, articoli.hit FROM articoli INNER JOIN categorie ON articoli.idCat = categorie.idCat WHERE articoli.idArt = ?" rsProdotto_cmd.Prepared = true rsProdotto_cmd.Parameters.Append rsProdotto_cmd.CreateParameter("param1", 5, 1, -1, rsProdotto__MMColParam) ' adDouble Set rsProdotto = rsProdotto_cmd.Execute rsProdotto_numRows = 0 %> < %Set ContaClick = Server.CreateObject ("ADODB.Command") ContaClick.ActiveConnection = MM_dbCatalogo_STRING ContaClick.CommandText = "UPDATE articoli SET hit = hit + 1 WHERE idArt = ?" ContaClick.Parameters.Append ContaClick.CreateParameter("MMColParam", 5, 1, -1, MM_IIF(Request.QueryString("idArt"), Request.QueryString("idArt"), rsProdotto__MMColParam & "")) ContaClick.CommandType = 1 ContaClick.CommandTimeout = 0 ContaClick.Prepared = true ContaClick.Execute() %>
There is anyone who can help me????