'************************************************* ***********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Option Explicit
Function Main()
Dim objConnection
Dim objRecordSet
Dim strTotal
Dim strPathtoTextFile
DTSGlobalVariables("sSub").Value = "Errors: = "
strtotal = strtotal & DTSGlobalVariables("sSub").Value & "0"
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
strPathtoTextFile = "M:\Rep\AA\"
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=NO;FMT=Delimited"""
objRecordset.Open "SELECT * FROM svcmont.txt", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until objRecordset.EOF
Wscript.Echo "Ty: " & objRecordset.Fields.Item("Ty")
Wscript.Echo "Va: " & objRecordset.Fields.Item("Va")
objRecordset.MoveNext
Loop
DTSGlobalVariables("sSub").Value = DTSGlobalVariables("sSub").Value &
objRecordset.Fields.Item("Va")
If strtotal <> DTSGlobalVariables("sSub").Value Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If
End Function
'************************************************* ***********************
Sample of input file:
Q, 0
QC, 0
Q, 0
Q, 0
Q, 0
QC, 0
Is this a replication script? I think you should repost this in the DTS
group.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Swim" <crombusch@.gmail.com> wrote in message
news:1138049022.892789.174050@.g43g2000cwa.googlegr oups.com...
> '************************************************* ***********************
> ' Visual Basic ActiveX Script
> '************************************************* ***********************
> Option Explicit
> Function Main()
> Dim objConnection
> Dim objRecordSet
> Dim strTotal
> Dim strPathtoTextFile
> DTSGlobalVariables("sSub").Value = "Errors: = "
> strtotal = strtotal & DTSGlobalVariables("sSub").Value & "0"
> On Error Resume Next
> Const adOpenStatic = 3
> Const adLockOptimistic = 3
> Const adCmdText = &H0001
> Set objConnection = CreateObject("ADODB.Connection")
> Set objRecordSet = CreateObject("ADODB.Recordset")
> strPathtoTextFile = "M:\Rep\AA\"
> objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & strPathtoTextFile & ";" & _
> "Extended Properties=""text;HDR=NO;FMT=Delimited"""
> objRecordset.Open "SELECT * FROM svcmont.txt", _
> objConnection, adOpenStatic, adLockOptimistic, adCmdText
> Do Until objRecordset.EOF
> Wscript.Echo "Ty: " & objRecordset.Fields.Item("Ty")
> Wscript.Echo "Va: " & objRecordset.Fields.Item("Va")
> objRecordset.MoveNext
> Loop
> DTSGlobalVariables("sSub").Value = DTSGlobalVariables("sSub").Value &
> objRecordset.Fields.Item("Va")
> If strtotal <> DTSGlobalVariables("sSub").Value Then
> Main = DTSTaskExecResult_Success
> Else
> Main = DTSTaskExecResult_Failure
> End If
> End Function
> '************************************************* ***********************
> Sample of input file:
> --
> Q, 0
> QC, 0
> Q, 0
> Q, 0
> Q, 0
> QC, 0
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment