WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

SQL Server Update Using ADO


This code opens a recordset with a simple query and loops through the records and updates the fields.
DB = ObjectCreate("adodb.connection")
DB.open("driver={SQL Server};server=es8;uid=;pwd=;catalog=pldatass")
RS = ObjectCreate("adodb.recordset")
RS.open("select doc_path from [pldatass].[dbo].[document]",db,1,4,1)

While ! rs.eof()
   old_value=StrTrim(StrLower(rs.fields("doc_path").value))
   new_value=StrReplace(old_value,"h:\edsi","s:")
   rs.fields("doc_path").value=new_value
   rs.updatebatch
   Message("",StrCat(old_value," --> ",RS.fields("doc_path").value))
   rs.movenext
EndWhile

RS = 0
DB = 0

Article ID:   W17114
File Created: 2007:07:03:14:28:22
Last Updated: 2007:07:03:14:28:22