dbTalk Databases Forums  

DTS ActiveX-ScriptTask

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS ActiveX-ScriptTask in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Daniela Menneweger
 
Posts: n/a

Default DTS ActiveX-ScriptTask - 11-14-2003 , 07:51 AM






Hello NG,

I'm new in DTS and hope you can help me.
I'm loop through a recordset in the VB-Script and I want to call a function
there. I defined a function with parameters and that's the problem:
Why can't I set parameters to new functions??

The error occurs at "Private Function PauseSumme(pnTerminalbuchungnr as
Integer) As String"!

Here's the code:
----------------------------------------

Function Main()

Dim con

set con = CreateObject("ADODB.Connection")
con.Open = "Provider=SQLOLEDB.1;Data Source=(local);Initial
Catalog=diTime;user id = 'sa';password='disoft'"

strSQL = "SELECT * FROM zztblTerminalBuchung "
set rsTerminal = CreateObject("ADODB.RecordSet")
rsTerminal.LockType = 3
rsTerminal.Open strSQL, con, , ,1
........

Do While (NOT rsTerminal.EOF)

Select Case rsTerminal("TERMINALBUCHUNG_CODE")
Case "AR"
..........................
strResult = PauseSumme rsTerminal("TERMINALBUCHUNG_NR")

End Select

If Not rsTerminal.EOF Then
rsTerminal.MoveNext
End If
Loop

End Function

' THE ERROR OCCURS HERE!!!!
Private Function PauseSumme(pnTerminalbuchungnr) As String

Dim strSQL

strSQL = "SELECT * FROM tblTerminalbuchungPause "
strSQL = strSQL & " WHERE TERMINALBUCHUNGPAUSE_TERMINALBUCHUNG_NR = " &
pnTerminalbuchungnr

set rsPause = CreateObject("ADODB.Recordset")
rsPause.LockType = 3
rsPause.Open strSQL, con, , , 1

If rsPause.EOF Then
PauseSumme = "00:00"
Else
PauseSumme = rsPause("PAUSE")
End IF

rsPause.Close
set rsPause = Nothing

End Function
-----------------------------------------

I hope you can help me.

Thanks in advance

Daniela Menneweger



Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: DTS ActiveX-ScriptTask - 11-14-2003 , 08:50 AM






In VB script there are no datatypes but variant.

"Daniela Menneweger" <nospam (AT) hotmail (DOT) com> wrote

Quote:
Hello NG,

I'm new in DTS and hope you can help me.
I'm loop through a recordset in the VB-Script and I want to call a
function
there. I defined a function with parameters and that's the problem:
Why can't I set parameters to new functions??

The error occurs at "Private Function PauseSumme(pnTerminalbuchungnr as
Integer) As String"!

Here's the code:
----------------------------------------

Function Main()

Dim con

set con = CreateObject("ADODB.Connection")
con.Open = "Provider=SQLOLEDB.1;Data Source=(local);Initial
Catalog=diTime;user id = 'sa';password='disoft'"

strSQL = "SELECT * FROM zztblTerminalBuchung "
set rsTerminal = CreateObject("ADODB.RecordSet")
rsTerminal.LockType = 3
rsTerminal.Open strSQL, con, , ,1
........

Do While (NOT rsTerminal.EOF)

Select Case rsTerminal("TERMINALBUCHUNG_CODE")
Case "AR"
..........................
strResult = PauseSumme rsTerminal("TERMINALBUCHUNG_NR")

End Select

If Not rsTerminal.EOF Then
rsTerminal.MoveNext
End If
Loop

End Function

' THE ERROR OCCURS HERE!!!!
Private Function PauseSumme(pnTerminalbuchungnr) As String

Dim strSQL

strSQL = "SELECT * FROM tblTerminalbuchungPause "
strSQL = strSQL & " WHERE TERMINALBUCHUNGPAUSE_TERMINALBUCHUNG_NR = " &
pnTerminalbuchungnr

set rsPause = CreateObject("ADODB.Recordset")
rsPause.LockType = 3
rsPause.Open strSQL, con, , , 1

If rsPause.EOF Then
PauseSumme = "00:00"
Else
PauseSumme = rsPause("PAUSE")
End IF

rsPause.Close
set rsPause = Nothing

End Function
-----------------------------------------

I hope you can help me.

Thanks in advance

Daniela Menneweger





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.