dbTalk Databases Forums  

Translation

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


Discuss Translation in the microsoft.public.sqlserver.dts forum.



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

Default Translation - 07-06-2003 , 11:40 PM






I was wondering if anyone could point to a website that
would help translate VB into VBScript.. Reason is that I
had a developer create a VB application tied into a SQL
server. A lot of his code is outdated and not very
useful. I'm trying to convert as much of it into DTS
packages. However, I'm having an issue with the declare
statements that he used

Example:
Sub GetCreditTypeComm(G As Variant, R As Double, N As
String)
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim dt As New Recordset, dt2 As New Recordset
R = 0
N = ""
dt.Open "select * from CREDITTYPE where ID=" & G, cn,
adOpenForwardOnly

If Not dt.EOF Then
dt2.Open "select * from COMMTYPE where ID=" & dt
("COMMTYPEID"), cn, adOpenStatic, adLockOptimistic
If Not dt2.EOF Then
R = MoveAmt2(dt2("RATE"))
N = "RATE" & MoveStr2(dt2("NAME"))
End If
dt2.Close
End If
End Sub


I need to know how to declare the "Sub GetCreditTypeComm(G
As Variant, R As Double, N As String)" part for VBScript.

Any help is greatly appreciated.
Thanks in advance


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Translation - 07-07-2003 , 02:15 AM






Hello, ScubaFrog!

In VBScript there is no such thing as

DIM a as <whatever>

so whereas in VB we would do

dim rs as ADODB.Recordset

in VBScript we would do

dim rs

SET rs = CREATEOBJECT("ADODB.Recordset")

Have a look at this tutorial

http://www.geocities.com/cliktoprogr...roduction.html

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

: Example:
: Sub GetCreditTypeComm(G As Variant, R As Double, N As
: String)
: Dim cmd As New ADODB.Command
: Dim rs As New ADODB.Recordset
: Dim rs1 As New ADODB.Recordset
: Dim dt As New Recordset, dt2 As New Recordset
: R = 0
: N = ""
: dt.Open "select * from CREDITTYPE where ID=" & G, cn,
: adOpenForwardOnly

: If Not dt.EOF Then
: dt2.Open "select * from COMMTYPE where ID=" & dt
: ("COMMTYPEID"), cn, adOpenStatic, adLockOptimistic
: If Not dt2.EOF Then
: R = MoveAmt2(dt2("RATE"))
: N = "RATE" & MoveStr2(dt2("NAME"))
: End If
: dt2.Close
: End If
: End Sub

: I need to know how to declare the "Sub GetCreditTypeComm(G
: As Variant, R As Double, N As String)" part for VBScript.

--- Microsoft CDO for Windows 2000



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.