Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    30

    Unanswered: Update field by +1

    I don't know how to update field in .mdb database by +1 in dreamweaver without form.

    I just want simple code which is called by:

    page.asp?ID=xx

    then when this page is open to add in:
    where ID=xx add to field counter=conter+1

    I have made all, but don't know how to update field with result in dreamweaver ;(.

    Code is bellow:

    <%
    Dim rsNovosti_Linkovi2__MMColParam
    rsNovosti_Linkovi2__MMColParam = "1"
    If (Request.QueryString("RB") <> "") Then
    rsNovosti_Linkovi2__MMColParam = Request.QueryString("RB")
    End If
    %>
    <%
    Dim rsNovosti_Linkovi2
    Dim rsNovosti_Linkovi2_numRows

    Set rsNovosti_Linkovi2 = Server.CreateObject("ADODB.Recordset")
    rsNovosti_Linkovi2.ActiveConnection = MM_connNovosti_STRING
    rsNovosti_Linkovi2.Source = "SELECT * FROM NajLinkovi WHERE RB = " + Replace(rsNovosti_Linkovi2__MMColParam, "'", "''") + ""
    rsNovosti_Linkovi2.CursorType = 0
    rsNovosti_Linkovi2.CursorLocation = 2
    rsNovosti_Linkovi2.LockType = 1
    rsNovosti_Linkovi2.Open()
    rsNovosti_Linkovi2_numRows = 0
    %>
    <%
    Clicks_number=(rsNovosti_Linkovi2.Fields.Item("Bro j_klikova").Value)+1
    %>

    <table width="100%" cellpadding="0" cellspacing="0">
    bla bla bla ...
    <%=Clicks_number%>

    cut...

    How now to update this field
    (rsNovosti_Linkovi2.Fields.Item("Broj_klikova").Va lue) with Clicks_number value?

    Thanks.

  2. #2
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    Code:
    <%
    rsNovosti_Linkovi2.Source = "put your sql here"
    rsNovosti_Linkovi2.Execute()
    %>
    Assuming you add it after dreamweaver closes the RS but before it sets rsNovosti_Linkovi2 to nothing, this will execute the sql you give it.

  3. #3
    Join Date
    Jan 2004
    Posts
    30
    Thanks, I'm not sure if I understand you.

    I must in SQL command put what I want to update?

    "put your sql here"


    or what, and that's problem for me don't know what to put here. Let's say I want to update
    <%
    (rsNovosti_Linkovi2.Fields.Item("Broj_klikova").Va lue)+1
    %>

    Thanks.

  4. #4
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    set it to something like this...

    Code:
    UDPATE NajLinkovi SET Broj_klikova=Broj_klikova+1 WHERE id=id of record
    Read this if you don't understand;
    http://www.w3schools.com/sql/sql_update.asp

  5. #5
    Join Date
    Jan 2004
    Posts
    30
    Thanks for help I understand now better everything, but now I get this error:

    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'Execute'
    /includes/novosti_linkovi2.asp, line 58

    line58:
    rsNovosti_Linkovi2.Execute()

    Try to search on google, no sucess ;(.

Posting Permissions

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