Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sachin.kale
Starting Member
6 Posts |
Posted - 2008-12-10 : 02:34:29
|
I am running my package using 'LoadFromSqlServer()' in SMO. I am successfully able to run it but I want number of rows which were affected using that package in a Database. So Is there any way for this.my code is as follows. Code Snippet Package pkgIn;Application app;DTSExecResult pkgResults;pkgIn = app.LoadFromSqlServer(PackPath ,ServerName , UserName , Passward , null);pkgResults = pkgIn.Execute();Please help me on this as I have wasted too much of time on this and I got no help for this..Thanx in adavance.. |
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2008-12-12 : 10:43:58
|
Create Stored Procedure with an output, catch this in DMO. E.G.USE [MyDatabase]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER OFFGOALTER PROCEDURE [dbo].[sTest] @output int outputASBEGIN UPDATE [MyDatabase].[dbo].[A] SET [testmoney] = '10' WHERE [testmoney] ='5'set @output = @@rowcountEND-----------------------------------Call Procedure and read output:Dim QueryResult Dim oServer Dim oDatabase Dim sResults Dim strSQLstrSQL = "declare @output int exec [MyDatabase].[dbo].[sTest] @output output select @output as arbitraryColName"Set oServer = CreateObject("SQLDmo.SqlServer") Set oDBFileData = CreateObject("SQLDMO.DBFile") Set oLogFile = CreateObject("SQLDMO.LogFile") oServer.LoginSecure = True oServer.Connect Set QueryResult = oServer.ExecuteWithResults(strSQL)Msgbox( QueryResult.GetColumnString(1, 1)) oServer.DisConnect Set oServer = Nothing |
 |
|
|
|
|