Code Check

Results 1 to 2 of 2

Thread: Code Check

  1. #1
    Join Date
    Dec 1969

    Default Code Check

    Hey all, for some reason when I go to update my DB, all records in the DB are updated. I only want to update the 1 record where my bid value = the record ID.<BR><BR>Also get type mismatch pointing ot line 21 <BR>objRS("bclickdatetime") = "&#124" & datetime<BR><BR>Its ok to put the contents of a field into a variable, add to the variable then put it back in the field, I mustnt be doing it correctly?<BR><BR>Could someone take a look. Any help is appreciated.<BR><BR>&#060;!--#include virtual="/engine1.asp" --&#062;<BR>&#060;%<BR>dim objRS, strimage, strimages, bip<BR><BR>strimage = Request.Querystring("image")<BR>bid = Request.Querystring("bid")<BR>bip = request.servervariables("REMOTE_ADDR")<BR>url = Request.QueryString("url")<BR>datetime = now()<BR><BR>mySQL=("SELECT bclicks, bclickdatetime, bclickip FROM tblbanners WHERE bid = " & bid )<BR><BR>dbOpen()<BR>set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Op en mySQL, dbConnect, 3, 3<BR><BR><BR>&#039;&#060;!-- problem start here--&#062;<BR>&#039;clickvariable = objRS("bclicks")<BR>&#039;bipcount = objRS("bclickip") <BR><BR>&#039;objRS("bclicks") = clickvariable + 1<BR>&#039;objRS("bclickdatetime") = "&#124" & datetime<BR>&#039;objRS("bclickip") = bipcount & "&#124" & bip<BR>objRS.Update<BR><BR>Response.Redirect(url)< BR><BR>objRS.Close<BR>set objRS = nothing<BR>dbClose()<BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default Why don't you use an...

    ...UPDATE statement instead? Should be a lot quicker (I think).<BR><BR>Anyway, I don&#039;t really see anything wrong with your code, provided bid contains a sensible value. I suggest you do a Response.Write of bid to make sure the SQL statement returns only one record.<BR><BR>Oliver.

Posting Permissions

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