Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Monday, March 12, 2012

Number / description of sql error

Hi

All Sql Server errors have a number. Is there any MS or MSDN website or any .net method in which I can see these errors?

Thanks a lot

switch (error.Number)

{

case 17:

msgErro =...

break;

case 4060:

msgErro =...

break;

case 18456:

msgErro = ....

break;

default:

msgErro = exSql.Message;

break;

}

Roberot,

The SQL Server error codes are in SQL Server Books On-line, which is part of the documentation that's installed with SQL Server. You may try googling "SQL Server error codes" if you don't have access to the documentation.

Good luck

|||

Roberot:

Hi

All Sql Server errors have a number. Is there any MS or MSDN website or any .net method in which I can see these errors?

Thanks a lot

switch (error.Number)

{

case 17:

msgErro =...

break;

case 4060:

msgErro =...

break;

case 18456:

msgErro = ....

break;

default:

msgErro = exSql.Message;

break;

}

Try the link below to download the BOL(books online). Hope this helps.

http://www.microsoft.com/downloads/details.aspx?FamilyID=BE6A2C5D-00DF-4220-B133-29C1E0B6585F&displaylang=en

Saturday, February 25, 2012

Null value for Web Service task input

I'm attempting to use the Web Service task to call a method provided by a vendor. The inputs are all simple types so that helps a lot, but for one input it's a string array. If I enter a single string value for a given id using the array dialog, the method works fine.

However if I try to change the input to use a variable to provide the value it fails. I'm assuming that you can't create a variable to return a string array. Please let me know if this is the case or if I'm missing something obvious ;-)

In addition, is there a way to specify a null value for an input? Currently there doesn't appear to be a way to do this in SP2. I tried leaving the string empty which didn't work and I tried using a variable with expression "NULL(DT_WSTR, 1252)" but that failed too.

You should be able to store an array of strings in a variable typed as Object. Not sure how well that will pass to the web service though.|||

Thanks for your reply John. As you suggested, I changed the variable type to object and assigned a string array to it. I was skeptical that it would work, but when I used that in the Web Service it worked! So many thanks to you!

Also I discovered a way to pass null values for parameters which is a bit unorthodox. You check the variable option for the input, but you don't select a variable and then that parameter is excluded from the request.

However there does appear to be one final obstacle which is that the timeout setting doesn't appear to work. Someone with a similar issue posted it at http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=277689 and I have validated it.

Monday, February 20, 2012

Null ParameterValue

Ok, seems like this should be a quick and easy one, but I can't find any info anywhere. How do I pass a ParameterValue to the Render method that represents a Null parameter?

Is this enough?

ParameterValue[] parameters = new ParameterValue[1];
ParameterValue nullParam = new ParameterValue();
nullParam.Name = "SomeParam";
nullParam.Value = "NULL";
parameters[0] = nullParam;

..
then set up everything else we need to call ReportingServices.Render...

Thanks
Scott

When you send "null" parameter value as url link to report server it looks like this:

http://reportserver/?%2fReport1Test&param1%3aisnull=True&rs%3aParameterLanguage=&rc%3aParameters=Collapsed

"param1" is the name of null valued parameter.

Hope this will help you somehow

Maciej

|||

Use this

nullParam.Value = System.DBNull.Value;

|||I'll try that, thank you. For the moment, sending the parameter values in with no value set (i.e. the string value property is null) seems to be working, though it could be related to the fact that the parameters have null values as a default, I will try what you suggest on my next report and post back the results here.|||I tried the System.DBNull.Value and I was getting an error because it was expecting a string. I passed String.Empty and that did the trick.