Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS ActiveX Script Update within recordset

Status
Not open for further replies.

panini

MIS
Jun 1, 2001
136
GB
Hi guys,

I'm running a dts activex script that inserts each line of a query into a csv file and then emails the file.... i need to make the process update my database as it writes each line... i've been trying to use the following code - which aint working - can anyone suggest a way to do this?

CURRENT CODE (this is just the bit that deals with this part of the process)

Set rs = cn.Execute("SELECT a,b,c FROM customers WHERE a,b,c")

if rs.bof or rs.eof then noOrders = true
if not noOrders then

strLine="" 'Initialize the variable for storing the filednames

'Retrieve the values from the database and write into the database
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine= strLine & chr(34) & x.value & chr(34) & chr(44)
next
MyFile.writeline strLine

if x.name = "b" then
wN= x.value

'set the email flag in the orders database
set rsConnU3 = CreateObject("ADODB.Connection")
set rs_ordersU3 = CreateObject("ADODB.Recordset")

rsConnU3.Open = "Provider=SQLOLEDB.1;Data Source=x; Initial Catalog=y;uid=xxx;password=xxx"

rsSQLCmdTextU3 = "UPDATE customers SET d= CONVERT(CHAR(8), GETDATE(), 112) WHERE (b= wN)"
rs_ordersU3.Open rsSQLCmdTextU3, rsConnU3

rs.MoveNext

Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top