Dot Net Learning Zone Blog

A blog about to learn Dot Net

Archive for the ‘SSIS’ Category

Execute SQL Task Pragmatically

Posted by Rajesh on April 25, 2010


Dim p As New Package()

Dim cm As ConnectionManager = p.Connections.Add("ADO.NET")

cm.ConnectionString = " Data Source=rajeshsharma\sql2005; Integrated Security=SSPI;Initial Catalog=test;"
Dim e As Executable = p.Executables.Add("STOCK:SQLTask")
Dim th As TaskHost = CType(e, TaskHost)
Dim est As ExecuteSQLTask = CType(th.InnerObject, ExecuteSQLTask)
est.Connection = cm.Name
est.SqlStatementSourceType = SqlStatementSourceType.DirectInput
est.SqlStatementSource = " CREATE TABLE TestTable7 ( ID int NOT NULL, Description nchar(100)); "
'run the package

Dim r As DTSExecResult = p.Execute()
If (r = DTSExecResult.Success) Then

End If

Posted in SSIS, Uncategorized | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.