[thelist] SQL Update Query - Easy

Scott Dexter dexilalolai at yahoo.com
Wed Jan 26 15:41:49 CST 2005


--- Rob Smith <rob.smith at THERMON.com> wrote:
> 
> set RS = Server.CreateObject("ADODB.Recordset")
> RS.ActiveConnection = MM_web_request_STRING
> RS.CursorType = 0
> RS.CursorLocation = 2
> RS.LockType = 3
> 	
> while  counter < uBound(Video)+1
> 	RS.Source = "Update tblVideos SET CheckedIn = 1 WHERE Video = '" &
> Video(counter) & "'"
> 	RS.Open()
> 	counter = counter + 1
> wend

You have to do an RS.Update() to get it to commit, IIRC.

BUT Eeek! Use an Update statement, dear boy. The recordset route is
seriously performance challenged. Change it up to

Set oDBConn = Server.CreateObject("ADODB.Connection")
oDBConn.Open(MM_web_request_STRING)
while counter<uBound(...)
   oDBConn.Execute "Update tblVideos SET CheckedIn = 1 WHERE Video =
'" & Video(counter) & "'"
wend
oDBConn.Close

and whatch it wiz by :)

Scott


More information about the thelist mailing list