Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SV: RE: Problems...umm..?


Message #1 by "SD-Studios" <info@s...> on Wed, 7 Nov 2001 19:30:49 +0100
Could you answer this instead?



Now here's the code as it is now. I've done some changes that makes the page

add new records all the time =( Now i get a lot of fields with the same date

and 1 in the downloads-field:



' Beginning overall download count

Set objCon2 = Server.CreateObject("ADODB.Connection")

objCon2.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=" &

Server.MapPath("database.mdb")

Set rsCounter2 = Server.CreateObject("ADODB.Recordset")

SQL3 = "SELECT * FROM downloads ORDER BY datum DESC"

rsCounter2.Open SQL3, objCon2



datum = rsCounter2("datum")



If datum = date Then



Set rsCounter3 = Server.CreateObject("ADODB.Recordset")

Set objCon3 = Server.CreateObject("ADODB.Connection")

objCon3.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=" &

Server.MapPath("database.mdb")



SQL4 = "SELECT * FROM downloads WHERE datum = '" & date & "'"

rsCounter3.Open SQL4, objCon3, adOpenKeyset, adLockPessimistic



iCount2 = rsCounter2("downloads")



rsCounter3.Fields("downloads") = iCount2 + 1

rsCounter3.Update

rsCounter3.Close



objCon3.Close



Else



Set rsCounter4 = Server.CreateObject("ADODB.Recordset")

Set objCon4 = Server.CreateObject("ADODB.Connection")

objCon4.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=" &

Server.MapPath("database.mdb")



SQL5 = "SELECT * FROM downloads"

rsCounter4.Open SQL5, objCon4, adOpenKeyset, adLockPessimistic



iCount3 = 0



With rsCounter4

 .AddNew

 .Fields("downloads") = iCount3 + 1

 .Fields("datum") = Date

 .Update

 .Close

End With



objCon4.Close



End If



rsCounter2.Close

objCon2.Close

' End overall download count



How should I do to make it + 1 where the date is the same instead?

--

Martin Johansson,

CEO & Project Supervisor

SD-Studios

http://www.sd-studios.com

http://www.sd-gaming.com




  Return to Index