Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Friday, March 30, 2012

passing parameter from vb 6 to crystal report 8

I am trying to pass value to the parameter field which i have created in crystal report 8. the parameter field is of type date. but i get error. the code is as follows.

.Reset
.ReportFileName = App.Path & "\reports\vaccine_flow_ledger.rpt"
.Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=APACCESS"
.DiscardSavedData = True

.ParameterFields(0) = "SDT;" & #1/7/2005#
.ParameterFields(1) = "EDT;" & #1/7/2005#

.Action = 1
End With

Please help me to resolve this problem.Try this

.ParameterFields(0) = "SDT;"# & 1/7/2005 & #"
.ParameterFields(1) = "EDT;"# & #1/7/2005& #"|||I tried that one,but i didn't work.

but

.parameterfields(0) = "sdt;" & "date(2005,1,1);"

works finesql

passing olap parameters in url

hi. could anyone pls tell me how to pass parameter values on url to an olap
RS 2005 report? i tried to do it as such and got an error.
parameter name is AbsenceTypesAbsenceTypes
parameter value is =[Absence Types].[Absence Types].[Absence Type].&[Absent
Days]
this is the link:
http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fCA_Reports%2fcAtt_01&rs:Command=Render&AbsenceTypesAbsenceTypes=[Absence
Types].[Absence Types].[Absence Type].&[Absent Days]
this is the error:
The path of the item "/CA_Reports/cAtt_01,[Absent Days]" is not valid. The
path must be less than 260 characters long and must not start with slash.
Other restrictions apply.
it's obvious that the & in the value of the parameter is causing this
problem.
also if somebody knows of a site where i can find help on this subject. i've
searched a lot and none talks about the current version of RS with olap.
ThanksURL parameter values always must be encoded. E.g. & needs to be encoded as
%26, [ would be %5B, ] would be %5D.
Lookup the HttpUtility class on MSDN - it provides a static method
HttpUtility.HtmlEncode to perform this encoding.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"TinaWina" <TinaWina@.discussions.microsoft.com> wrote in message
news:1B900061-7EF8-4FC5-AA0D-EE61C20E5E53@.microsoft.com...
> hi. could anyone pls tell me how to pass parameter values on url to an
> olap
> RS 2005 report? i tried to do it as such and got an error.
> parameter name is AbsenceTypesAbsenceTypes
> parameter value is =[Absence Types].[Absence Types].[Absence
> Type].&[Absent
> Days]
> this is the link:
> http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fCA_Reports%2fcAtt_01&rs:Command=Render&AbsenceTypesAbsenceTypes=[Absence
> Types].[Absence Types].[Absence Type].&[Absent Days]
> this is the error:
> The path of the item "/CA_Reports/cAtt_01,[Absent Days]" is not valid. The
> path must be less than 260 characters long and must not start with slash.
> Other restrictions apply.
> it's obvious that the & in the value of the parameter is causing this
> problem.
> also if somebody knows of a site where i can find help on this subject.
> i've
> searched a lot and none talks about the current version of RS with olap.
> Thanks|||Thank you very much.
It worked:)
"Robert Bruckner [MSFT]" wrote:
> URL parameter values always must be encoded. E.g. & needs to be encoded as
> %26, [ would be %5B, ] would be %5D.
> Lookup the HttpUtility class on MSDN - it provides a static method
> HttpUtility.HtmlEncode to perform this encoding.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "TinaWina" <TinaWina@.discussions.microsoft.com> wrote in message
> news:1B900061-7EF8-4FC5-AA0D-EE61C20E5E53@.microsoft.com...
> > hi. could anyone pls tell me how to pass parameter values on url to an
> > olap
> > RS 2005 report? i tried to do it as such and got an error.
> > parameter name is AbsenceTypesAbsenceTypes
> > parameter value is =[Absence Types].[Absence Types].[Absence
> > Type].&[Absent
> > Days]
> >
> > this is the link:
> > http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fCA_Reports%2fcAtt_01&rs:Command=Render&AbsenceTypesAbsenceTypes=[Absence
> > Types].[Absence Types].[Absence Type].&[Absent Days]
> >
> > this is the error:
> > The path of the item "/CA_Reports/cAtt_01,[Absent Days]" is not valid. The
> > path must be less than 260 characters long and must not start with slash.
> > Other restrictions apply.
> >
> > it's obvious that the & in the value of the parameter is causing this
> > problem.
> >
> > also if somebody knows of a site where i can find help on this subject.
> > i've
> > searched a lot and none talks about the current version of RS with olap.
> >
> > Thanks
>
>

Monday, March 26, 2012

Passing int parameter to stored procedure question.

Hi all,

I had created a stored procedure "DeleteRow" that can receive a parameter "recordID" from the calling function, however, I received a error msg "Procedure or function deleteRow has too many arguments specified." when run the C# code.
My code is showing below
----------- -------
thisConnection.Open();
SqlParameter param = DeleteRow.Parameters.Add("@.recordI D", SqlDbType.Int, 4);
param.Value = key;
SqlDataReader reader = DeleteRow.ExecuteReader(CommandBeh avior.CloseConnection) //program stop after runing this line
The stored procedure code which is showing below:
--------------------
CREATE PROCEDURE dbo.deleteRow @.recordID INT AS DELETE FROM ShoppingCart WHERE RecordID = @.recordID
Can anyone give me some ideal why this happen.
Thank alot.
wing

I don't know exactly, maybe you made a mistake here:
"@.recordI D",
see the whitespace

|||You should be using ExecuteNonQuery. ExecuteReader is designed to return data, not update.
|||omg, I've overlooked that. :$
You can also use an ExecuteScalar. In contract to ExecuteNonQuery, itwill get the first field of the first row. Usefull when using a returnvalue in a stored procedure...

Passing error messages from stored procedure to osql command

I have a process that is running on the os. This process is picking up FTP files every 5 min, it renames them so not to confuse them with the new files, copies all renamed files into one file to be used by bulk insert, runs the bulk insert to populate a table, and then runs the stored procedure that scrubbing the data and insert it into another table. For every transaction that I do in my stored procedure, I do the error checking as follows:

IF @.@.error <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN

If my stored procedure encounters an error, return statement will stop it from running. If this happens, I need to stop the process that is running on the os as well.

Questions:

How can that be accomplished?

How to restart the stored procedure ones the error has been corrected?

Thank you for your help.Use "/b" with your OSQL, and use RAISERROR in your error trapper. In the batch file check "ERRORLEVEL 1":

osql ..... /b
if errorlevel 1 goto blah-blah|||Do you have a sample that I can look at? Thanks|||Watch out for word wrapping.
This one runs DBCC INDEXDEFRAG on specified server + database.

@.echo off
set server=%1
set db=%2
set uid=-U%3
set pwd=-P%4
if "%1"=="" goto ServerError
if "%2"=="" set db=master
if "%3"=="" set uid=-E
if "%4"=="" set pwd=
echo Checking for existence of a view on server %server% database %db%...
osql -S %server% %uid% %pwd% -d %db% -l 1 -Q"if object_id('dbo.vw_DBCC_INDEX_DEFRAG') is not null drop view dbo.vw_DBCC_INDEX_DEFRAG" -b
if errorlevel 1 goto LoginFailure
echo Creating a view on server %server% database %db%...
osql -S %server% %uid% %pwd% -d %db% -i"Create_vw_DBCC_INDEX_DEFRAG.SQL" -b
if errorlevel 1 goto CreateViewError
if "%uid%"=="-E" set uid=-T
echo Generating the final script for server %server% database %db%...
bcp %db%.dbo.vw_DBCC_INDEX_DEFRAG out %server%_%db%_DBCC_INDEX_DEFRAG.SQL -S %server% %uid% %pwd% -c
if "%uid%"=="-T" set uid=-E
echo Processing INDEXDEFRAG script on %server% database %db%...
osql -S %server% %uid% %pwd% -d %db% -i %server%_%db%_DBCC_INDEX_DEFRAG.SQL -h-1 -n -w 256 -o %server%_%db%_DBCC_INDEX_DEFRAG.LOG -b
if errorlevel 1 goto ScriptProcessingError
echo Check %server%_%db%_DBCC_INDEX_DEFRAG.LOG for any errors!
goto end
:ServerError
echo No server and/or database specified!
echo Execution returned Error Code %ERRORLEVEL%
goto end
:LoginFailure
echo Failed to login to %server%!
echo Execution returned Error Code %ERRORLEVEL%
goto end
:CreateViewError
echo Failed to create vw_DBCC_INDEX_DEFRAG!
echo Execution returned Error Code %ERRORLEVEL%
goto end
:ScriptProcessingError
echo Failed to process the script: %server%_%db%_DBCC_INDEX_DEFRAG.SQL
echo Execution returned Error Code %ERRORLEVEL%
goto end
:end
@.echo on

Passing error description to failure task in DTS

In my DTS package, is there any way to pass the task name and error description to another task that gets called on the task's failure?In my DTS package, is there any way to pass the task name and error description to another task that gets called on the task's failure?
I have a bunch of packages that implement the same "on error" task as an Execute Package Task (in other words, my error handling task is its own seperate package). In each package that implements that error task, I set a global variable with the task name whose failure I'm trapping. Then in the error handling task I read the value of the global variable to fill an email notification.

If I knew how to trap the actual error, either in a global variable or with script, I'd stick that in a global variable and do the same thing, so maybe if someone knows how to do that...

Friday, March 23, 2012

Passing DateTime Parameter to Subreport (Error)

Hi guys,

I have managed to pass a string parameter form the main report to the subreport with no problems, but when i try and use the same method to pass a datetime type, i am issued with the following error messase:

"[rsErrorExecutingSubreport] An error occurred while executing the subreport ‘SubReportName’: The value provided for the report parameter 'MasterDate' is not valid for its type."

I cant see why it work for strings, but not for datetime. Any suggestions will be very much appreciated

Just to clarify, i am using the same dateTime type to define both main and sub report parameters|||Does anybody know why i am getting this error. Your help will be very much appreciated.|||Does anybody know why i am getting this error?

Friday, March 9, 2012

Passing "ORDER BY" parameter causes error

Hi everyone,

I want to be able to pass an "ORDER BY" parameter into my stored procedure but I am receiving errors when I do. For example:

CREATE PROCEDURE GetFromTable
(
@.SortOn varchar(20)
)
AS
SELECT *
FROM Table
ORDER BY @.SortOn
GO

This is the error I get: Variables are only allowed when ordering by an expression referencing a column name. Any suggestions on what I can do to make this work?

Thanks in advance,

PietWhy?

This is bad on so many levels...why not go dynamic crazy?

USE Northwind
GO

CREATE PROC mySproc99
@.TABLE_NAME sysname, @.WHERE varchar(2000), @.ORDERBY varchar(2000)
AS
BEGIN
DECLARE @.sql varchar(8000)
SELECT @.sql = 'SELECT * FROM ' + @.TABLE_NAME
+ ' WHERE ' + @.WHERE
+ ' ORDER BY ' + @.ORDERBY
EXEC(@.sql)
END
GO

EXEC mySproc99 'Orders','OrderId > 0','ShippedDate'
GO

DROP PROC mySproc99
GO|||Brilliant code! Henceforth, the only stored proc in my databases shall be this "one-size-fits-all" piece of code. However, I think I may make it even more universal like this:

USE Northwind
GO

CREATE PROC mySproc99
@.SQLStatement(4000)
AS
BEGIN
EXEC(@.SQLStatement)
END
GO

EXEC mySproc99 'select * from Orders where OrderId > 0 order by ShippedDate'
GO

DROP PROC mySproc99
GO

Much more functional and versatile, wouldn't you agree? The only stored procedure you will ever need!|||blindman,

Are you for reals?

Henceforth, the only stored proc in my databases shall be this "one-size-fits-all" piece of code.

Or, are you being a bit facetious?

Thanks for the help guys. Going dynamic makes things a bit easier for sure.

Piet|||I'm suspecting the BRETT was being facetious...|||What meaning does "This is bad on so many levels" carry?|||Piet:

When Brett wrote "This is bad on so many levels..." he was trying to convey the idea that dynamic code is potentially a bad thing, and when used in this way (to dynamically change the order of the results), it is worse than usual.

Dynamic code opens up all kinds of possibilities for problems like SQL Injection, etc. If the user has any control over what string gets passed into your dynamic SQL, you've basically given them the keys to the kingdom as far as what they can do.

Both Brett and Blindman were attempting to show some of the problems that can arise from dynamic code. While there are a few uses for dynamic code (and heaven knows I seem to post a lot of it), they are really few and far between for production code. Dynamic SQL belongs in the DBA's bag of tricks, but you need to be very stingy about using it... It should only be as a last resort, and no part of the dynamic SQL should EVER be controlled by the end user.

-PatP|||You should think about why you are asking the database to custom-order results in the first place. Ordering the results may stray into the realm of data-presentation, and would then be better left to the interface to handle.

What interface, dare I ask, are you using?|||Many years ago (8?) I was experimenting with procedure subscripts in 6.5, and actually employed this rarely used feature in one of my apps. It may sound inefficient, but it is by far much better than resorting to dynamic SQL:

create proc myproc;1 as
select * from pubs.dbo.authors order by 1
go
create proc myproc;2 as
select * from pubs.dbo.authors order by 2
go
create proc myproc;3 as
select * from pubs.dbo.authors order by 3
go
create proc myproc;4 as
select * from pubs.dbo.authors order by 4
go

Then all your FE needs to do is to make determination which subscript to append to the call of the proc to get the results in the specific order.|||Blindman,

Good question and I think you're right that I could probably take care of the sorting in a Dataview. I am using a repeater in a web form app using c#.

Thanks for the reminder.

Piet

pass variable with a space

Hi,

I am passing a filename to a command in sql.

The problem is that it gives an error if the @.FullFilePath has a space in it.

set @.cmd = 'dtexec /f ' + @.FullPackagePath + ' /set \Package.Variables[User::FileName].Properties[Value];' + @.FullFilePath + '"'

print @.cmd

Thanks

As with everything, use quotes... ""|||

This is the stored procedure which passes the filename

uspCEMTradeExecutePackage 'd:\sysappl\CEM\SSIS\Imports\Trades\csa.dtsx', 'CSA data.csv'

Notice the filename, i.e. 'CSA data.csv'

It has a space in it.

Do you mean the call to the stored procedure should be:

uspCEMTradeExecutePackage 'd:\sysappl\CEM\SSIS\Imports\Trades\csa.dtsx', '"CSA data.csv"'

this does not seem correct.

Thanks

|||

That is correct, you need the single quotes outside of the double quotes. When you call DTEXEC with a variable or path that has spaces in it, it has to be wrapped in double quotes.

Or you could change the command line to include the double quotes:

Code Snippet

set @.cmd = 'dtexec /f ' + @.FullPackagePath + ' /set \Package.Variables[User::FileName].Properties[Value];"' + @.FullFilePath + '"'

Pass value to stored procedure longer than 128 character

Hi all,

I want to pass a value longer more than 128 character but get an error.

what can i do?

I use sql 2005 and Visual Basic 6

thank'sI think you need to give a better description of the error; please give the exact message that you are getting. There is no problem passing an argument to a stored procedure that is longer than 128 characters. Also, can you potentially change the stored procedure and re-create or alter the stored procedure if the problem terns out to be the size of the argument?|||Thank for quikly response,

first i'm sorry about my english.

i was tried to pass parameter more small to the stored, and all was ok, the resultes are right.

I think the problem are only the lengh, i've only italian error description :

"La lunghezza del valore identificatore che inizia con '*MY PARAMETER*' è eccessiva.
La lunghezza massima consentita è 128."

I've edit stored for replace value more small to real value.

Example:

'VALUES EXPLANATION
SHORT VALUE REAL VALUE
DOF DATAORAFINE
DOS DATAORASCADENZA
DOI DATAORAINIZIO
'**************************************

'STORED CODE
SET @.CRITDATA = REPLACE(@.CRITDATA,'DOF','DATAORAFINE')
SET @.CRITDATA = REPLACE(@.CRITDATA,'DOS','DATAORASCADENZA')
SET @.CRITDATA = REPLACE(@.CRITDATA,'DOI','DATAORAINIZIO')

There is an other solution

thank's
Davide|||

Can you post the entire procedure? This works:

create procedure test
(
@.parameter varchar(200)
) as
select len(@.parameter), @.parameter
go
exec test '01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
go

Returns:

-- --
200 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

|||all right,

I've used double apen fore execute query from SQL MANAGEMENT STUDIO, now with the single apex work!

Thanks a lot|||

Just to be clear.

You were putting double quotes ("text") around the argument rather than single('text').

The problem was that putting double quotes around the text is the same as putting it in square brackets ([text]). This means that the text is treated as an identifier (and not as text), and identifiers in SQL Server are limited to 128 characters.

Thought we ought to make it clear what the problem had been and how it had been fixed.

|||

"You were putting double quotes ("text") around the argument rather than single('text'). "

Ah, nice catch. That went right over (past) my head, if only I could have read Italian (from google's translator:)

“The length of the identificatore value that it begins with “*MY PARAMETER*” is excessive. The concurred maximum length is 128.”

D'oh!

Wednesday, March 7, 2012

pass sql error to ksh

Can someone tell me how to pass the sql error to the
ksh script? we would like to trap for certain error messages
coming from sql, but because the script processes good we
don't seem to get the "record not found" from the sql
ThanksIf you are using SQL*Plus, check its WHENEVER SQLERROR command.

Saturday, February 25, 2012

pass Column Name using Parameter in SQL Statement...

Hi,

I am trying to Pass Column Name(FieldName) using Parameter in SQL
Statement... But i am getting error...

how can i pass Column name using parameter?

Example:

in table i have fieldname ECountry...

Select @.FName='ECountry'
Select @.FName from Table...

How it works?

Thanx in Advance,
Regards,
Raghu...(raghutumma@.gmail.com) writes:

Quote:

Originally Posted by

I am trying to Pass Column Name(FieldName) using Parameter in SQL
Statement... But i am getting error...
>
how can i pass Column name using parameter?
>
Example:
>
in table i have fieldname ECountry...
>
Select @.FName='ECountry'
Select @.FName from Table...
>
How it works?


Why would you do it in the first place? Given a well-designed database,
the request does not make very much sense. But if you have a less well-
designed database, you need to do:

SELECT CASE @.paramname
WHEN 'thatfield' THEN thatfield
WHEN 'thisfield' THEN thisfield
WHEN 'leftfield' THEN leftfield
END
FROM tbl

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||>how can i pass Column name using parameter? <<

You don't do this; it is bad programming. A well-designed module of
code returns a predictable result. What you have is what I call a
"Britney Spears, Squids and Automobiles" module, since it can return
anything of any data type!

Get a book on basic Software Engineering and read about coupling and
cohesion before you do any more programming in any language.|||On Oct 19, 9:06 am, --CELKO-- <jcelko...@.earthlink.netwrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

how can i pass Column name using parameter? <<


>
You don't do this; it is bad programming. A well-designed module of
code returns a predictable result. What you have is what I call a
"Britney Spears, Squids and Automobiles" module, since it can return
anything of any data type!
>
Get a book on basic Software Engineering and read about coupling and
cohesion before you do any more programming in any language.


Maybe they weren't responsible for the database design, but are being
asked query from it due to business requirements or maybe it's not a
critical application and it's was easier to load a flat file into
Access than to design a proper normalized database. Regardless, it's
a legitimate question (as are your concerns about unpredictable
results), but to assume that Raghu doesn't know basic Software
Engineering is rude.|||<paulschultz54@.gmail.comwrote in message
news:1193191383.235885.139270@.y27g2000pre.googlegr oups.com...

Quote:

Originally Posted by

On Oct 19, 9:06 am, --CELKO-- <jcelko...@.earthlink.netwrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>how can i pass Column name using parameter? <<


>>
>You don't do this; it is bad programming. A well-designed module of
>code returns a predictable result. What you have is what I call a
>"Britney Spears, Squids and Automobiles" module, since it can return
>anything of any data type!
>>
>Get a book on basic Software Engineering and read about coupling and
>cohesion before you do any more programming in any language.


>
Maybe they weren't responsible for the database design, but are being
asked query from it due to business requirements or maybe it's not a
critical application and it's was easier to load a flat file into
Access than to design a proper normalized database. Regardless, it's
a legitimate question (as are your concerns about unpredictable
results), but to assume that Raghu doesn't know basic Software
Engineering is rude.


You know, Joe has written several books, SQL for Smarties comes to mind.

However, one book that I doubt he'll ever be asked to write is "Joe Celko's
Guide to Winning Friends and Influencing People."

:-)

Quote:

Originally Posted by

>


--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Or... Practical SQL Solutions in the Real World.

--
Tony Rogerson, SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]
http://sqlserverfaq.com
[UK SQL User Community]

"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.comwrote in message
news:13hubgltianpsb8@.corp.supernews.com...

Quote:

Originally Posted by

<paulschultz54@.gmail.comwrote in message
news:1193191383.235885.139270@.y27g2000pre.googlegr oups.com...

Quote:

Originally Posted by

>On Oct 19, 9:06 am, --CELKO-- <jcelko...@.earthlink.netwrote:

Quote:

Originally Posted by

>>how can i pass Column name using parameter? <<
>>>
>>You don't do this; it is bad programming. A well-designed module of
>>code returns a predictable result. What you have is what I call a
>>"Britney Spears, Squids and Automobiles" module, since it can return
>>anything of any data type!
>>>
>>Get a book on basic Software Engineering and read about coupling and
>>cohesion before you do any more programming in any language.


>>
>Maybe they weren't responsible for the database design, but are being
>asked query from it due to business requirements or maybe it's not a
>critical application and it's was easier to load a flat file into
>Access than to design a proper normalized database. Regardless, it's
>a legitimate question (as are your concerns about unpredictable
>results), but to assume that Raghu doesn't know basic Software
>Engineering is rude.


>
You know, Joe has written several books, SQL for Smarties comes to mind.
>
However, one book that I doubt he'll ever be asked to write is "Joe
Celko's Guide to Winning Friends and Influencing People."
>
:-)
>
>

Quote:

Originally Posted by

>>


>
>
>
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com
http://www.greenms.com/sqlserver.html
>
>

Pass back error count to Parent pkg

I am trying to pass back the number of errors encountered by a child package to the Parent package. I have a script within the child package, which will set the value of the Parent package's variable (ChildErrCount). However, I have no idea how to access the Child package's Errors collection to get a count.

Any ideas? Has someone figured out a way to reference the current package's properties (besides what's available from Dts.* ?

Thanks!

See the following topic:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=20103&SiteID=1

|||I should clarify ... I want to know how to get the number of Errors. I already know how to pass the value back.
|||

Why don't you want to use the error information available through dts.*?

Here is a useful link (although it uses the dts.* approach):

http://www.developerdotstar.com/community/node/327

NOTE: you can then push these values to a variable and pass it up to the parent package...

|||

OK, ignore any parent/child aspects of my question.

Let's say your package has a bunch of errors, and sometimes you get a warning message:

The Execution method succeeded, but the number of errors raised (6) reached the maximum allowed (1);

I want to know how to get that "6" value, (i.e. I don't need to know any specific error info). It's obviously stored within the package -- I just want access to it.

Initially I was thinking I could code my way into the Package and retrieve the Errors Collection; then use its Count property:

CurrentPackage.Errors.Count

But, there's no easy way to do that, which is why I'm here.

|||

You could put something in the OnError eventhandler that simply increments a variable every time it executes.

If another way exists, I don't know about it. perhaps Microsoft do. [Microsoft follow-up]

-Jamie

|||

The Package object support the "Errors" property which you can call the "Count" method. Unfortunately you cannot get access to the package object inside script task. This is a design decision. The only way to get to property is via the programming object model.

I am not aware of any workaround beside Jamie's suggestion.

|||Since you are calling this from a parent package, you could run the child package through a script task, instead of the Execute Package task. That way, you could access the Package.Errors property of the child package.|||

That's a neat idea, John. I hadn't thought of that. I was hoping to avoid recalculating a count that already existed, but for now Jamie's workaround seems to be the simplest solution so I'll go with that.

Thanks to all!

Pass back error count to Parent pkg

I am trying to pass back the number of errors encountered by a child package to the Parent package. I have a script within the child package, which will set the value of the Parent package's variable (ChildErrCount). However, I have no idea how to access the Child package's Errors collection to get a count.

Any ideas? Has someone figured out a way to reference the current package's properties (besides what's available from Dts.* ?

Thanks!

See the following topic:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=20103&SiteID=1

|||I should clarify ... I want to know how to get the number of Errors. I already know how to pass the value back.
|||

Why don't you want to use the error information available through dts.*?

Here is a useful link (although it uses the dts.* approach):

http://www.developerdotstar.com/community/node/327

NOTE: you can then push these values to a variable and pass it up to the parent package...

|||

OK, ignore any parent/child aspects of my question.

Let's say your package has a bunch of errors, and sometimes you get a warning message:

The Execution method succeeded, but the number of errors raised (6) reached the maximum allowed (1);

I want to know how to get that "6" value, (i.e. I don't need to know any specific error info). It's obviously stored within the package -- I just want access to it.

Initially I was thinking I could code my way into the Package and retrieve the Errors Collection; then use its Count property:

CurrentPackage.Errors.Count

But, there's no easy way to do that, which is why I'm here.

|||

You could put something in the OnError eventhandler that simply increments a variable every time it executes.

If another way exists, I don't know about it. perhaps Microsoft do. [Microsoft follow-up]

-Jamie

|||

The Package object support the "Errors" property which you can call the "Count" method. Unfortunately you cannot get access to the package object inside script task. This is a design decision. The only way to get to property is via the programming object model.

I am not aware of any workaround beside Jamie's suggestion.

|||Since you are calling this from a parent package, you could run the child package through a script task, instead of the Execute Package task. That way, you could access the Package.Errors property of the child package.|||

That's a neat idea, John. I hadn't thought of that. I was hoping to avoid recalculating a count that already existed, but for now Jamie's workaround seems to be the simplest solution so I'll go with that.

Thanks to all!