SSRS 2008 parameter getting nvarchar instead of varchar
I created three tables in SQL Server 2008, all with
Code char(1) not null,
Description varchar(50)
then three sprocs, all by
create name_menu as
begin
set nocount on;
select Code,
Code + ' - ' Description as Description
from name;
end;
(name being the part the varies)
Added each sproc to an SSRS 2008 report as a dataset. then added each dataset as a parameter, with Code as Value, Description as label
In the report, two of the menus look as expected, but one shows only the code, the ' - ' and the first letter of the description. If I add the parameter value to the report as a textbox, the description part has the "boxes" typical of trying to display UTF-16 little endian in an ASCII field.
I searched the XML of the report a开发者_运维知识库nd found that all non-numeric datatypes are String or System.String
I checked
SELECT inf...schema.columns where DATATYPE = 'NVARCHAR'
...and there are none.
I deleted the sproc and ran the create statement again, then told SSRS to refresh the fields.
Older versions of SSRS used to cache data and sometimes would fail to refresh, so I looked for cache files to delete. Didn't find any.
I should be able to cast the results, but I shouldn't have to. (And it wouldn't surprise to be told "you can't do that")
Advice?
(embarrassed) Don't know how it happened, but somehow the original text in the table was converted to UTF-16, and inserted back into the table as if it were ASCII. So every other character was a null. SSRS was attempting to render what was actually there as the datatype it was claimed to be.
Since I had seen the correct text in the table shortly before seeing the bogus text in SSRS, I didn't bother looking there again. A colleague actually found it.
It does show two bugs though: SSRS did the right thing in a text box, showing each null as a "box" But in the menu, it treated the first null as the end of the string. And SSMS did the same thing in the results grid of a select statement.
In the DataSet dialogs, you can see both parameter and resultset data types. The error will be there.
Check these for typos or errors. Or in the stored procs which the dialog boxes "sniff" to get the data types (but not likely based on information given).
What SSRS uses internally does not matter...
精彩评论