Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Help with a ADO Connection in a script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1697
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Help with a ADO Connection in a script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Help with a ADO Connection in a script - 12/13/2004 7:44:50 AM   
  Jeff_York

 

Posts: 1
Score: 0
Joined: 12/13/2004
From:
Status: offline
Good afternoon-

THe following is part of a DTS package. What I am trying to do is to rename a file that uses the result of a DB Query as a part of the rename. I am having some difficulties, If anyone can point me in the right direction I appreciate it. Here is the relavant part of the script:

Dim FileDate
Dim DateString
Dim FSO
Dim File
Dim RouteDate
Dim oCon
Dim oRS
Dim sSQL


Set oCon = CreateObject("ADODB.Connection")
oCon.Open "Driver={SQL Server};" & _
"Server=rdoesql;" & _
"Database=eqsavers;" & _
"Trusted_Connection=yes"

sSQL = "Select INV_Date From CTRL_DATE Where CTRL_NAME = 'INVDT'"

Set oRS = oCon.Execute(sSQL)

If Not oRS.EOF Then
RouteDate = oRS(INV_Date)
FileDate = Date
DateString = DatePart("yyyy",FileDate) & Right("0" & _
DatePart("m",FileDate), 2) & Right("0" & DatePart("d",FileDate), 2)& RIght("0" & DatePart("h",Now),2) & RIght("0" & DatePart("n",Now),2) & Right("0" & DatePart("s",Now),2)

Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "\\Irv_Server\EqSavers\CSCExport.txt", "\\Irv_Server\EQSavers\Archived_Exports\"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile("\\Irv_Server\EqSavers\Archived_Exports\CSCExport.txt")
File.Name = "CSCExport" & DateString & RouteDate & ".txt"

End If
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Help with a ADO Connection in a script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts