Showing posts with label flag. Show all posts
Showing posts with label flag. Show all posts

Monday, March 19, 2012

Error in sample PrinterDeliveryProvider.cs?

The Deliver method in the sample returns false if the delivery is successful
and never sets the Notification.Retry flag. Both seem to contradict the
documentation. Please confirm that the sample is wrong and the
documentation is right.
Thanks,
- SteveThat is true. The documentation is correct. The printer delivery extension
sample should be changed to reflect the documentation.
--
Bryan Keller
Developer Documentation
SQL Server Reporting Services
A friendly reminder that this posting is provided "AS IS" with no
warranties, and confers no rights.
"Stephen Walch" <swalch@.proposion.com> wrote in message
news:OpQ$ZirXEHA.3512@.TK2MSFTNGP12.phx.gbl...
> The Deliver method in the sample returns false if the delivery is
successful
> and never sets the Notification.Retry flag. Both seem to contradict the
> documentation. Please confirm that the sample is wrong and the
> documentation is right.
> Thanks,
> - Steve
>|||One more thing. To make the sample more accurate, I would recommend changing
the retry flag to a success flag, like:
public bool Deliver(Notification notification)
{
bool success = false;
// Set the status of the notification to pending
notification.Status = "Processing...";
try
{
// Build user data
Setting[] userSettings = notification.UserData;
SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.FromSettings(userSettings);
// Print the report
PrintReport(notification, subscriptionData);
// If delivery is successful return false
success = true;
}
catch (Exception e)
{
// Set the status of the notification if an error occurs
// and attempt retry
notification.Status = "Error: " + e.Message;
success = false;
}
finally
{
// Finally, save the notification information
notification.Save();
}
return success;
}
Bryan Keller
Developer Documentation
SQL Server Reporting Services
A friendly reminder that this posting is provided "AS IS" with no
warranties, and confers no rights.
"Stephen Walch" <swalch@.proposion.com> wrote in message
news:OpQ$ZirXEHA.3512@.TK2MSFTNGP12.phx.gbl...
> The Deliver method in the sample returns false if the delivery is
successful
> and never sets the Notification.Retry flag. Both seem to contradict the
> documentation. Please confirm that the sample is wrong and the
> documentation is right.
> Thanks,
> - Steve
>|||Don't you also want to set the Retry flag?
catch (Exception e)
{
// Set the status of the notification if an error occurs
// and attempt retry
notification.Status = "Error: " + e.Message;
notification.Retry = true;
success = false;
}|||Hi,
During to build "Sample Printer Delivery Extension", the document write:
2.Issue the following command to create the sample delivery extension
Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll.
csc /t:library /out:Microsoft.Samples.ReportingServices.PrinterDelivery.dll
*.cs /r:Microsoft.ReportingServices.Interfaces.dll
During to build "Sample Printer Delivery Extension", the
How should I Implement this command? Please give me advice, thanks for your
time!
Angi|||CSC is the C# compiler which ships with the .Net Framework. It should be
installed on your computer if you installed the .Net Framework v. 1.1.4322.
-Lukasz
This posting is provided "AS IS" with no warranties, and confers no rights.
"angi" <angi@.microsoft.com> wrote in message
news:uCWemPUbEHA.3752@.TK2MSFTNGP12.phx.gbl...
> Hi,
> During to build "Sample Printer Delivery Extension", the document write:
> 2.Issue the following command to create the sample delivery extension
> Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll.
> csc /t:library
/out:Microsoft.Samples.ReportingServices.PrinterDelivery.dll
> *.cs /r:Microsoft.ReportingServices.Interfaces.dll
> During to build "Sample Printer Delivery Extension", the
> How should I Implement this command? Please give me advice, thanks for
your
> time!
> Angi
>|||You can also build it by opening the .SLN file in Visual Stidio.NET 2003.
-Steve
"angi" <angi@.microsoft.com> wrote in message
news:uCWemPUbEHA.3752@.TK2MSFTNGP12.phx.gbl...
> Hi,
> During to build "Sample Printer Delivery Extension", the document write:
> 2.Issue the following command to create the sample delivery extension
> Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll.
> csc /t:library
/out:Microsoft.Samples.ReportingServices.PrinterDelivery.dll
> *.cs /r:Microsoft.ReportingServices.Interfaces.dll
> During to build "Sample Printer Delivery Extension", the
> How should I Implement this command? Please give me advice, thanks for
your
> time!
> Angi
>

Sunday, February 19, 2012

error in --> EXEC xp_cmdshell ''bcp "SELECT * FROM tbl a where a.flag=N" queryout

some one can tell if i can make a "where" clause inside the BCP , when i say : select * FROM tbl where flag=N , usually the where flag='N' works with the ' ' , but it gives no error when save the store procedure without it ' ' saves nicely the SP,

but

like this it saves well "SELECT * FROM tbl where flag=N" and

when i execute it, give a sql statement error "Error = [Microsoft][SQL Native Client][SQL Server]Invalid column name N."

i dont now , any help

PS: perhaps at the end of the BCP > -c -T , must have some more or less

Here the solution,

You have to use the escape sequence (Like \' or \" in other programming langauages).

SQL escape sequence for single quote is consecutive 2 single quotes ''.

EXEC xp_cmdshell 'bcp "SELECT * FROM tbl a where a.flag=''N''"

|||

Manivannan.D.Sekaran wrote:

Here the solution,

You have to use the escape sequence (Like \' or \" in other programming langauages).

SQL escape sequence for single quote is consecutive 2 single quotes ''.

EXEC xp_cmdshell 'bcp "SELECT * FROM tbl a where a.flag=''N''"

yes i tryed both ways with 'N' and "N" and it says the same error message

with this

'bcp "SELECT * FROM delta.dbo.tblRANGEL_O_STOCKS where updt="N"" queryout "'

Error = [Microsoft][SQL Native Client][SQL Server]Invalid column name 'N'.

with this says

'bcp "SELECT * FROM delta.dbo.tblRANGEL_O_STOCKS where updt= 'N' " queryout "'

Msg 102, Level 15, State 1, Procedure spDELTA_P1_RANGEL_STOCKS, Line 59

Incorrect syntax near ' " queryout "'.

|||

Please copy and paste the following code,

Instead of 2 single quotes you are trying with 1 double quote.

Code Snippet

EXEC xp_cmdshell 'bcp "SELECT * FROM tbl a where a.flag=''N''" queryout F.txt -c -T'

|||

THANK YOU A LOT

and it was only a little thing like a '

Wednesday, February 15, 2012

Error handling when one field value is bad

Here's an example of what I'm playing with:

update TestTable

set IntValue = Cast(StringValue, as int)

flag =

BEGIN TRY

0

END TRY

BEGIN CATCH

1

END CATCH

I'm trying to take a string value holding an integer and populate an integer field with that value. But, every so often, the string value does not contain an integer (e.g. '13.9" or "CA"). That error would cause the entire column UPDATE to be rolled back. i'm trying to get around it with some kind of "TRY CATCH" construct but I don't believe it can work.

What would you suggest?

Barkingdog

No, you are right this won′t work. For me, the best Exception handling is to prevent exceptions, in your case check the value for being numeric, there is a function ISNUMERIC which can do that for you. But be careful with that function, because it checks for currency numeric only, so the value "$" which is part of a currency expression will also evaluate to true.

See more details on the site: http://www.aspfaq.com/show.asp?id=2390

HTH, jens Suessmeyer.

http://www.sqlserver2005.de