Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB4/32, VB5, VB6, SQL Server 7.0
Expertise: Advanced
Jun 25, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Execute a SQL Server DTS Package Remotely

You can easily execute a SQL Server 7.0 Data Transformation Services (DTS) package from VB remotely:
  1. Create a DTS package. It can be an import from Excel into SQL Server.
  2. Set a reference to Microsoft DTS Package Object Library in any VB project. You might need to load SQL Server on the development machine.
  3. Use the LoadFromSQLServer method on the package object:

Private Sub cmdRefreshCustomers_Click()
Dim oPackage As New DTS.Package
On Error GoTo eh
'Load the package that we created previously 
' ("Customer_List").
'Use the global variables for SQL Server name, UserID, 
'and Password.
oPackage.LoadFromSQLServer sServername, sUid, sPwd, _
	DTSSQLStgFlag_Default, _
	"", "", "", "Customer_List", 0
'Execute the Package
MsgBox oPackage.Description, vbInformation, _
	"Re-import Excel sheet."
'Clean up.
Set oPackage = Nothing
Exit Sub
MsgBox Err.Description, vbCritical, _
	"Error refreshing Customer List"
'For more sophisticated sample VB code with DTS, go 
'to the SQL Server 7 CD and browse these folders: 
'devtools\samples\dts\dtsempl1 or 2 or 3.
End Sub
This is a simple, powerful way to take advantage of any DTS package.

Steve Simon
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date