Home > Archive > MS SQL Server DTS > January 2006 > T-SQL strong. VBScript weak. Help?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author T-SQL strong. VBScript weak. Help?
JuiceN

2006-01-26, 4:58 pm

I need an activeX script that will:

Query a table in my database:

Select FailReason from ErrorLog where DateOfFileCopy = getDate()

I want to store the result in a variable called flds.

then:

If Flds = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If


Help?????
I can't fill in the missing pieces (i.e, the get the data part)

Thanks
JuiceN

2006-01-26, 4:58 pm

update:


This is as far as i have gotten with this:

'*******************
********************
********************
***********
' Visual Basic ActiveX Script
'*******************
********************
********************
*************
Option Explicit

Public Function Main()



Dim db as Database, myRecordset as Recordset, mySQLCmdText as string


mySQLCmdText = "Select FailReason from [ErrorLog] where [DateOfFileCopy] =
getDate()"
set myRecordset = db. OpenRecordSet(mySQLC
mdText)

If myRecordset![FailReason] = 0 Then
DTSGlobalVariables("ExecuteTruePath").Value = True
Else
DTSGlobalVariables("ExecuteTruePath").Value = False
End If
Main = DTSTaskExecResult_Su
ccess


End Function

====================
====================
========

"JuiceN" wrote:

> I need an activeX script that will:
>
> Query a table in my database:
>
> Select FailReason from ErrorLog where DateOfFileCopy = getDate()
>
> I want to store the result in a variable called flds.
>
> then:
>
> If Flds = 0 Then
> DTSGlobalVariables
("ExecuteTruePath").Value = True
> Else
> DTSGlobalVariables
("ExecuteTruePath").Value = False
> End If
>
>
> Help?????
> I can't fill in the missing pieces (i.e, the get the data part)
>
> Thanks

Allan Mitchell

2006-01-26, 4:58 pm

Hello JuiceN,


There is a far simpler way than having to do some VBcript coding.

Use an ExecuteSQL task to assign the value from the statement to a Global
Variable.

Your statement would stay the same.

The statement you are issuing in fct is very precise for a log record you
are asking for the row where DataOfFileCopy = Getdate(). This is very precise.

Allan



[color=darkred]
> update:
>
> This is as far as i have gotten with this:
>
> '*******************
********************
********************
**********
> *
> ' Visual Basic ActiveX Script
> '*******************
********************
********************
**********
> ***
> Option Explicit
> Public Function Main()
>
> Dim db as Database, myRecordset as Recordset, mySQLCmdText as string
>
> mySQLCmdText = "Select FailReason from [ErrorLog] where
> [DateOfFileCopy] =
> getDate()"
> set myRecordset = db. OpenRecordSet(mySQLC
mdText)
> If myRecordset![FailReason] = 0 Then
> DTSGlobalVariables("ExecuteTruePath").Value = True
> Else
> DTSGlobalVariables("ExecuteTruePath").Value = False
> End If
> Main = DTSTaskExecResult_Su
ccess
> End Function
>
> ====================
====================
========
>
> "JuiceN" wrote:
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com