Textbox name cannot start with a number in SSRS2008?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 18:27:22

问题


I'm working with SSRS 2008 in some existing reports I have. One of the new requirements is to add a few columns and two of them begins with a number in its header. For example: 170T_Test.

When displaying the data and headers in the Report Viewer all is OK.

HOWEVER, the problem is when exporting to CSV format. Since the headers showed in this format are taken from the textbox property name, I had to put 170T_Test as the name. But, trying to do that the SSRSS 2008 IDE shows the following messages error:

"Specify a valid name. The name cannot contain spaces, and it must begin with a letter followed by letter, numbers, or the undescore character (_)"

So, based on all the explained above, is there a way to have the textbox starting with a number? or is it prohibited?

Regards!


回答1:


It can be achieved in two different ways.

I prefer method 1. It is much better and reuseable.

Method 1:
Step 1
Update your report dataset to include the headers on row 1.

SELECT * FROM
(
 SELECT Field1, Field2, 2 as rowOrder
  FROM Tables
  Where Conditions
 UNION ALL
 SELECT '170T Test' AS Field1, '180 T$' AS Field2, 1 as rowOrder
) ORDER BY rowOrder

Step 2:
Modify the RSReportServer.config file on Report server to customize CSV export to exclude header.

2012 config file Location: C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer

2008 File Location: \Program Files\Microsoft SQL Server\MSSQL.n\Reporting Services\ReportServer

Imp: Make a backup of the RSReportServer.config in case you need to rollback your changes.

Add another entry in <render> section below CSV extension.

<Extension name="CSVNoHeader" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV No Header</Name>
    </OverrideNames>
    <Configuration>
        <DeviceInfo>
            <NoHeader>true</NoHeader>
        </DeviceInfo>
     </Configuration>
</Extension>

Save it. Now you have another drop down export option CSV No Header along with CSV, PDF, XML. Users can use this option to extract the data the way they want.

MSDN Link to customize Rendering extension

Method 2:
STEP 1 Same as above

STEP 2 Use URL access and specify the device info for no header http://msdn.microsoft.com/en-us/library/ms155046.aspx




回答2:


Resources can't start with a number or a reserved word, if you do this, visual studio will automaticly add an underscore '_' in front of your name. Your problem probably has something to do with this.



来源:https://stackoverflow.com/questions/22637444/textbox-name-cannot-start-with-a-number-in-ssrs2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!