If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Update field by +1

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-04, 03:21
dove_g dove_g is offline
Registered User
 
Join Date: Jan 2004
Posts: 30
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.
Reply With Quote
  #2 (permalink)  
Old 01-23-04, 07:13
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
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.
Reply With Quote
  #3 (permalink)  
Old 01-23-04, 09:06
dove_g dove_g is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 01-23-04, 09:25
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
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
Reply With Quote
  #5 (permalink)  
Old 02-02-04, 02:36
dove_g dove_g is offline
Registered User
 
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 ;(.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On