Results 1 to 2 of 2

Thread: DTS Help

  1. #1
    Join Date
    May 2003
    Location
    Atlanta, GA
    Posts
    187

    Unanswered: DTS Help

    Hey guys,
    In my DTS package I have an ActiveX Script that basicaly checkes if records exist in a table something like this:
    Const adOpenKeyset = 1
    Const adLockOptimistic = 3

    Function FindRec()

    Dim objConn
    Dim sql
    Dim rs

    Dim Success

    Success = 0

    sqlconn = "DSN=SAConn;UID=PSI_Admin;PWD=psiadmin001;DATABASE =SA"

    Set objConn = CreateObject("ADODB.Connection")
    objConn.Open sqlconn

    sql = "SELECT NAM FROM tblUnassignedNAM "

    Set rs = CreateObject("ADODB.RecordSet")
    rs.Open sql, objConn, adOpenKeyset, adLockOptimistic

    If rs.EOF = False Then

    Success = 1

    End If

    rs.Close
    Set rs = Nothing

    objConn.Close
    Set objConn = Nothing

    If Success = 1 Then
    FindRec = DTSStepExecResult_Success
    ElseIf Success = 0 Then
    FindRec = DTSStepExecResult_Failure
    End If


    End Function

    If you notice at the end I say
    If Success = 1 Then
    FindRec = DTSStepExecResult_Success
    ElseIf Success = 0 Then
    FindRec = DTSStepExecResult_Failure
    End If

    So if there are no records it should fail and do something else, but the process does not fail it's successful. Why is that?

  2. #2
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    You are simply returning the numeric value of the errors. You are not throwing an error.
    -bpd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •