1
votes

I have been asked to create an RDLC report in a VB.net winforms application.

The datasource for my report is a long existing SQL Stored Procedure that is currently used to fill a datagrid in the application. The SPROC returns field names with spaces and the RDLC report I created balks at non CLS compliant names.

The only practical way for me to write this report is to use the SPROC since the report data MUST match the datagrid presentation. I absolutely don't want to create a new SPROC and then hope that other developers know to maintain both SPROC's.

To create my RDLC report I created a dataset in VB.net and added a typed datatable (right click design surface > add > table) then I manually added each column name from the SPROC.

Is there a way to generate alias names in the datatable ?

Any other ideas ?

1
You can modify the original SPROC to alias the column names with the "as" keyword. Just remove the spaces in the alias and then update your datatable.Eric Walker
Thanks but I have no idea how many legacy apps I will break by changing the names of the returned fields.user3511334

1 Answers

1
votes

Sure, use a table variable and exec and then select from that:

declare @results table
(
name varchar(255),
field varchar(255),
filename varchar(255),
filegroup varchar(255),
user3511334 varchar(255),
maxsize varchar(255),
growth varchar(255),
JohnMoreno varchar(255)
);
insert @results  exec sp_helpfile;
select * from @results;