473,574 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Application Project - ReportViewer Control

AG
I am trying to use a ReportViewer control in a VS 2005 web application
project (not Website project).
When I try to create a new report (local), I can't seem to find any method
to create a datasource. I would like to use an existing class object.
The examples I have found state that the class should be in the App_Code
folder. However a WAP does not have an App_Code folder.

Is there any way to specify a datasource for a local report in a WAP, or
must all reports be remote?

Thanks,

--

AG
Email: discuss at adhdata dot com
Aug 20 '07 #1
10 3745
Hi AG,

From your description, you're wondering how to supply the DataSource for
the webform reportviewer control in an ASP.NET Web Application Project,
correct?

Based on my understanding, for webform reportviewer, you can supply the
datasource through the following means:

1) if you use the .NET built-in typed DataSet/TableAdpater components, you
can simply add a new typed DataSet(with TableAdapter) and the DataSet class
will appear in the VS 2005 ide's "Website Datasource" window. You can drag
the certain table's properties(colu msn) onto the client report(rdlc)'s
design surface.

#Walkthrough: Using a Database Data Source with the ReportViewer Web Server
Control in Local Processing Mode
http://msdn2.microsoft.com/en-us/lib...23(VS.80).aspx

#the DataSet approach will work in both website project and Web Application
Project.

2) Or if you're using some custom class(which return the DataTable or
typedDataTable ), it seems the built-in "WebSite Data Source" windows can
not display it at design-time. One way to workaround it is as below:

1. In the SmartTag for the Report Viewer control, click Choose Data Source.

2. In the Choose Data Sources dialog, click inside the Data Source Instance
column and choose New Data Source.

3. Choose Object in the list of data sources.

4. In the Choose your business object combo-box, you should already see the
name of the Table Adapter that your report will use when it pulls
data...choose it. Or if you do not see your custom class, uncheck the "show
only data components" option so that all businesss classes will be availale
in the list:

5. Finish off the wizard...you now should be in good shape.

Or you can also manually select to use a custom class in aspx template:
=============== =============
<rsweb:ReportVi ewer ID="ReportViewe r2" runat="server" >
<LocalReport ReportPath="Cli entReport1.rdlc ">
<DataSources>
<rsweb:ReportDa taSource
DataSourceId="O bjectDataSource 2" Name="DataSet1_ rpt_table" />
</DataSources>
</LocalReport>
</rsweb:ReportVie wer>
<asp:ObjectData Source ID="ObjectDataS ource2" runat="server"
SelectMethod="G etDataTable"

TypeName="WAPTe stProj.MyDataSo urceClass"></asp:ObjectDataS ource>
=============== ==============

Here the "WAPTestProj.My DataSourceClass " is a custom class as below:

===========

public class MyDataSourceCla ss
{
public DataSet1.rpt_ta bleDataTable GetDataTable()
{
DataSet1TableAd apters.rpt_tabl eTableAdapter ta = new
DataSet1TableAd apters.rpt_tabl eTableAdapter() ;

DataSet1.rpt_ta bleDataTable table = new
DataSet1.rpt_ta bleDataTable() ;

ta.Fill(table);

return table;
}
}
=============== ===

In addition, you can also programmaticall y create and add datasource for
ReportViewer control. Here is a web forum thread discuss on this:

http://forums.microsoft.com/MSDN/Sho...70944&SiteID=1

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 20 '07 #2
Thanks for your reply AG,

So your main concern is to view and use the custom datasource objects when
author the client report(RDLC) file, correct?

After some further research, I did found some existing problem about the
"Website Data Sources" windows which can not correctly display Business
object classes. And there is also some community members submit bug
requests on the public connect site(which has been recorded as an internal
bug entry):

#114670. Business Object Website Data Sources vanish when working with
RDLC
https://connect.microsoft.com/Visual....aspx?Feedback
ID=114670

So far I found that one of the workaround in the above url can helps us
some on this issue. As one member mentioned, if your business class's
method(which return the data records that will be bound to report data
region) will return an List(or Array) type object, it can be recognized and
displayed in the WebSite datasource window. I've tested in a Web
Application Project and it does work. For your scenario, you can try add a
method that return an List or Array of the certain data object class and
use it to author the report. How do you think?

Here is a test class I used which can be display in "website data sources"
window. BTW, I put it in a class library project:

===========
namespace ClassLib
{
public class MyDataSource
{

public List<EmployeeGe tEmployees()
{
return new List<Employee>( );
}
}

[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public class Employee
{
private int _id;
private string _name;

public int ID
{
get { return _id; }
set { _id = value; }
}

public string Name
{
get { return _name; }
set { _name = value; }
}
}
}
=============== ========

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.



Aug 23 '07 #3
AG
Thanks Steven,

Yes, I see that 'List(of object)' is recognized.
My classes already return datatables, but I have not found a simple method
to convert a datatable or dataview to a list(of object) or list(of array).

Is there such a method?

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:Z9******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Thanks for your reply AG,

So your main concern is to view and use the custom datasource objects when
author the client report(RDLC) file, correct?

After some further research, I did found some existing problem about the
"Website Data Sources" windows which can not correctly display Business
object classes. And there is also some community members submit bug
requests on the public connect site(which has been recorded as an internal
bug entry):

#114670. Business Object Website Data Sources vanish when working with
RDLC
https://connect.microsoft.com/Visual....aspx?Feedback
ID=114670

So far I found that one of the workaround in the above url can helps us
some on this issue. As one member mentioned, if your business class's
method(which return the data records that will be bound to report data
region) will return an List(or Array) type object, it can be recognized
and
displayed in the WebSite datasource window. I've tested in a Web
Application Project and it does work. For your scenario, you can try add
a
method that return an List or Array of the certain data object class and
use it to author the report. How do you think?

Here is a test class I used which can be display in "website data sources"
window. BTW, I put it in a class library project:

===========
namespace ClassLib
{
public class MyDataSource
{

public List<EmployeeGe tEmployees()
{
return new List<Employee>( );
}
}

[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public class Employee
{
private int _id;
private string _name;

public int ID
{
get { return _id; }
set { _id = value; }
}

public string Name
{
get { return _name; }
set { _name = value; }
}
}
}
=============== ========

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.



Aug 23 '07 #4
Thanks for your followup AG,

So in your scenario, those Business class has already been well defined and
only return DataTable, dataset objects, right?

I've performed some further research and I suggest you consider the
following workaround:

** You can still keep the original business class's methods that return
DataTable, however, you can add a new method which return the typed DataRow
array. e.g. (the "GetDataRecords " method in the below class)

=============== ============
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapter s.rpt_tableTabl eAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

return table;
}

public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapter s.rpt_tableTabl eAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

TDS.rpt_tableRo w[] rows = new TDS.rpt_tableRo w[table.Rows.Coun t];

table.Rows.Copy To(rows, 0);

return rows;
}
}
=============== ========
** Thus, at development time, you can see the class and design the report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(which return DataTable)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 24 '07 #5
AG
Thanks Steven,

This looks promising, but I am having some trouble understanding it.
Could you please repeat it in VB and explain the origin of the object
sources (rpt_tableTable Adapter, etc) a bit more.
I have looked at help for table adapters and the examples are similar, but
still confusing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9T******** *******@TK2MSFT NGHUB02.phx.gbl ...
Thanks for your followup AG,

So in your scenario, those Business class has already been well defined
and
only return DataTable, dataset objects, right?

I've performed some further research and I suggest you consider the
following workaround:

** You can still keep the original business class's methods that return
DataTable, however, you can add a new method which return the typed
DataRow
array. e.g. (the "GetDataRecords " method in the below class)

=============== ============
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapter s.rpt_tableTabl eAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

return table;
}

public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapter s.rpt_tableTabl eAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

TDS.rpt_tableRo w[] rows = new
TDS.rpt_tableRo w[table.Rows.Coun t];

table.Rows.Copy To(rows, 0);

return rows;
}
}
=============== ========
** Thus, at development time, you can see the class and design the report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(which return DataTable)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.


Aug 24 '07 #6
Thanks for your reply AG,

Sorry that I haven't noticed you're using VB.NET.

Here is a VB.NET code snippet demonstrate some on this:

#in the following class, suppose GetDataTable() is the originally
function which directly return the TypedDataTable, now you can add a new
function that return the array of "TypedDataR ow", like the "GetDataRecords "
function:
===============
Public Class MyDataSource

Public Function GetDataTable() As SimpleDS.UsersD ataTable

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")
Return dt

End Function
Public Function GetDataRecords( ) As SimpleDS.UsersR ow()

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")

Dim rows() As SimpleDS.UsersR ow
ReDim rows(dt.Rows.Co unt)

dt.Rows.CopyTo( rows, 0)

Return rows
End Function
End Class
==============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
References: <#m************ **@TK2MSFTNGP02 .phx.gbl>
<OH************ **@TK2MSFTNGHUB 02.phx.gbl>
<uL************ **@TK2MSFTNGP05 .phx.gbl>
<Z9************ **@TK2MSFTNGHUB 02.phx.gbl>
<ON************ *@TK2MSFTNGP06. phx.gbl>
<9T************ *@TK2MSFTNGHUB0 2.phx.gbl>
>Subject: Re: Web Application Project - ReportViewer Control
Date: Fri, 24 Aug 2007 11:29:16 -0400
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Message-ID: <uC************ **@TK2MSFTNGP04 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: ool-44c55ef0.dyn.op tonline.net 68.197.94.240
Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP04.phx .gbl
Xref: TK2MSFTNGHUB02. phx.gbl microsoft.publi c.dotnet.framew ork.aspnet:3967 8
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Thanks Steven,

This looks promising, but I am having some trouble understanding it.
Could you please repeat it in VB and explain the origin of the object
sources (rpt_tableTable Adapter, etc) a bit more.
I have looked at help for table adapters and the examples are similar, but
still confusing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9T******* ********@TK2MSF TNGHUB02.phx.gb l...
>Thanks for your followup AG,

So in your scenario, those Business class has already been well defined
and
only return DataTable, dataset objects, right?

I've performed some further research and I suggest you consider the
following workaround:

** You can still keep the original business class's methods that return
DataTable, however, you can add a new method which return the typed
DataRow
array. e.g. (the "GetDataRecords " method in the below class)

============== =============
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapte rs.rpt_tableTab leAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

return table;
}

public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapte rs.rpt_tableTab leAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

TDS.rpt_tableRo w[] rows = new
TDS.rpt_tableR ow[table.Rows.Coun t];

table.Rows.Copy To(rows, 0);

return rows;
}
}
============== =========
** Thus, at development time, you can see the class and design the report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(which return DataTable)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.



Aug 27 '07 #7
AG
Thanks Steven,

Now I see where my problem lies.
My class is returning an un-typed datatable which is generated from a stored
procedure.
Can you point me so an example of creating a typed-datatable from an untyped
one?

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:Vm******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Thanks for your reply AG,

Sorry that I haven't noticed you're using VB.NET.

Here is a VB.NET code snippet demonstrate some on this:

#in the following class, suppose GetDataTable() is the originally
function which directly return the TypedDataTable, now you can add a new
function that return the array of "TypedDataR ow", like the
"GetDataRecords "
function:
===============
Public Class MyDataSource

Public Function GetDataTable() As SimpleDS.UsersD ataTable

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")
Return dt

End Function
Public Function GetDataRecords( ) As SimpleDS.UsersR ow()

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")

Dim rows() As SimpleDS.UsersR ow
ReDim rows(dt.Rows.Co unt)

dt.Rows.CopyTo( rows, 0)

Return rows
End Function
End Class
==============

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
>>Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
References: <#m************ **@TK2MSFTNGP02 .phx.gbl>
<OH************ **@TK2MSFTNGHUB 02.phx.gbl>
<uL************ **@TK2MSFTNGP05 .phx.gbl>
<Z9************ **@TK2MSFTNGHUB 02.phx.gbl>
<ON************ *@TK2MSFTNGP06. phx.gbl>
<9T************ *@TK2MSFTNGHUB0 2.phx.gbl>
>>Subject: Re: Web Application Project - ReportViewer Control
Date: Fri, 24 Aug 2007 11:29:16 -0400
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Message-ID: <uC************ **@TK2MSFTNGP04 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: ool-44c55ef0.dyn.op tonline.net 68.197.94.240
Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP04.phx .gbl
Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.pub lic.dotnet.fram ework.aspnet:39 678
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Thanks Steven,

This looks promising, but I am having some trouble understanding it.
Could you please repeat it in VB and explain the origin of the object
sources (rpt_tableTable Adapter, etc) a bit more.
I have looked at help for table adapters and the examples are similar, but
still confusing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9T****** *********@TK2MS FTNGHUB02.phx.g bl...
>>Thanks for your followup AG,

So in your scenario, those Business class has already been well defined
and
only return DataTable, dataset objects, right?

I've performed some further research and I suggest you consider the
following workaround:

** You can still keep the original business class's methods that return
DataTable, however, you can add a new method which return the typed
DataRow
array. e.g. (the "GetDataRecords " method in the below class)

============= ==============
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapt ers.rpt_tableTa bleAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

return table;
}

public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdapt ers.rpt_tableTa bleAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

TDS.rpt_tableRo w[] rows = new
TDS.rpt_table Row[table.Rows.Coun t];

table.Rows.Copy To(rows, 0);

return rows;
}
}
============= ==========
** Thus, at development time, you can see the class and design the
report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(whic h return DataTable)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.




Aug 29 '07 #8
Thanks for your reply AG,

Now, I've seen the main problem here, your datatable are untyped. This does
be a big problem as untyped DataTable do not have strong-typed properties
that can be recognized by the design-time DataSource window.

So far I think you may consider the following approach:

** use code to write out the XML Schema for your untyped dataset/datatable,
here is a demo code snippet to do this:
=========
private void button1_Click(o bject sender, EventArgs e)
{

DataSet ds = new DataSet("myds") ;
DataTable dt = new DataTable("tb1" );
dt.Columns.Add( "id", typeof(long));
dt.Columns.Add( "name", typeof(string)) ;
dt.PrimaryKey = new DataColumn[]{dt.Columns["id"]};

dt.Rows.Add(1, "item1");
dt.Rows.Add(2, "item2");

dt.WriteXmlSche ma("dt_scheme.x sd");

}
}
=============== =

**after that, add the output xsd file(generarted above) into your project
and let the VS IDE create a typed dataset/datatable for you.

** use the new generated type dataset/datatable type in your business class
to create the fake method(be used by datasource window)

How do you think? If you have any further questions on this, please feel
free to let me know.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
>
Thanks Steven,

Now I see where my problem lies.
My class is returning an un-typed datatable which is generated from a
stored
>procedure.
Can you point me so an example of creating a typed-datatable from an
untyped
>one?

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:Vm******* *******@TK2MSFT NGHUB02.phx.gbl ...
>Thanks for your reply AG,

Sorry that I haven't noticed you're using VB.NET.

Here is a VB.NET code snippet demonstrate some on this:

#in the following class, suppose GetDataTable() is the originally
function which directly return the TypedDataTable, now you can add a new
function that return the array of "TypedDataR ow", like the
"GetDataRecord s"
function:
============== =
Public Class MyDataSource

Public Function GetDataTable() As SimpleDS.UsersD ataTable

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")
Return dt

End Function
Public Function GetDataRecords( ) As SimpleDS.UsersR ow()

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")

Dim rows() As SimpleDS.UsersR ow
ReDim rows(dt.Rows.Co unt)

dt.Rows.CopyTo( rows, 0)

Return rows
End Function
End Class
============ ==

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
>>>Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
References : <#m************ **@TK2MSFTNGP02 .phx.gbl>
<OH*********** ***@TK2MSFTNGHU B02.phx.gbl>
<uL*********** ***@TK2MSFTNGP0 5.phx.gbl>
<Z9*********** ***@TK2MSFTNGHU B02.phx.gbl>
<ON*********** **@TK2MSFTNGP06 .phx.gbl>
<9T*********** **@TK2MSFTNGHUB 02.phx.gbl>
>>>Subject: Re: Web Application Project - ReportViewer Control
Date: Fri, 24 Aug 2007 11:29:16 -0400
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Message-ID: <uC************ **@TK2MSFTNGP04 .phx.gbl>
Newsgroups : microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: ool-44c55ef0.dyn.op tonline.net 68.197.94.240
Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP04.phx .gbl
Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.pu blic.dotnet.fra mework.aspnet:3 9678
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Thanks Steven,

This looks promising, but I am having some trouble understanding it.
Could you please repeat it in VB and explain the origin of the object
sources (rpt_tableTable Adapter, etc) a bit more.
I have looked at help for table adapters and the examples are similar,
but
>>>still confusing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9T***** **********@TK2M SFTNGHUB02.phx. gbl...
Thanks for your followup AG,

So in your scenario, those Business class has already been well defined
and
only return DataTable, dataset objects, right?

I've performed some further research and I suggest you consider the
following workaround:

** You can still keep the original business class's methods that return
DataTable, however, you can add a new method which return the typed
DataRow
array. e.g. (the "GetDataRecords " method in the below class)

============ ===============
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdap ters.rpt_tableT ableAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

return table;
}

public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAdap ters.rpt_tableT ableAdapter();

TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();

ta.Fill(table);

TDS.rpt_tableRo w[] rows = new
TDS.rpt_tabl eRow[table.Rows.Coun t];

table.Rows.Copy To(rows, 0);

return rows;
}
}
============ ===========
** Thus, at development time, you can see the class and design the
report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(whi ch return DataTable)

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.




Aug 31 '07 #9
AG
Steven,

A columns in a datatable derived from a SQL strored procedure contain the
schema info, so I don't understand why the datatable would not be considered
typed.

Anyway, are you saying that the only way to create a typed datatable, is to
create a separate xsd file and the loop through all my rows and add them to
the new datatable??

That seems very inefficient.

I might be better off creating a separate reports project and deploy to the
report server and use remote processing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:C9******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Thanks for your reply AG,

Now, I've seen the main problem here, your datatable are untyped. This
does
be a big problem as untyped DataTable do not have strong-typed properties
that can be recognized by the design-time DataSource window.

So far I think you may consider the following approach:

** use code to write out the XML Schema for your untyped
dataset/datatable,
here is a demo code snippet to do this:
=========
private void button1_Click(o bject sender, EventArgs e)
{

DataSet ds = new DataSet("myds") ;
DataTable dt = new DataTable("tb1" );
dt.Columns.Add( "id", typeof(long));
dt.Columns.Add( "name", typeof(string)) ;
dt.PrimaryKey = new DataColumn[]{dt.Columns["id"]};

dt.Rows.Add(1, "item1");
dt.Rows.Add(2, "item2");

dt.WriteXmlSche ma("dt_scheme.x sd");

}
}
=============== =

**after that, add the output xsd file(generarted above) into your project
and let the VS IDE create a typed dataset/datatable for you.

** use the new generated type dataset/datatable type in your business
class
to create the fake method(be used by datasource window)

How do you think? If you have any further questions on this, please feel
free to let me know.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
>>Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
>>
Thanks Steven,

Now I see where my problem lies.
My class is returning an un-typed datatable which is generated from a
stored
>>procedure.
Can you point me so an example of creating a typed-datatable from an
untyped
>>one?

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:Vm****** ********@TK2MSF TNGHUB02.phx.gb l...
>>Thanks for your reply AG,

Sorry that I haven't noticed you're using VB.NET.

Here is a VB.NET code snippet demonstrate some on this:

#in the following class, suppose GetDataTable() is the originally
function which directly return the TypedDataTable, now you can add a new
function that return the array of "TypedDataR ow", like the
"GetDataRecor ds"
function:
============= ==
Public Class MyDataSource

Public Function GetDataTable() As SimpleDS.UsersD ataTable

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")
Return dt

End Function
Public Function GetDataRecords( ) As SimpleDS.UsersR ow()

Dim dt As New SimpleDS.UsersD ataTable
dt.Rows.Add(1, "name1", "email1")
dt.Rows.Add(2, "name2", "email2")

Dim rows() As SimpleDS.UsersR ow
ReDim rows(dt.Rows.Co unt)

dt.Rows.CopyTo( rows, 0)

Return rows
End Function
End Class
============= =

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
Reply-To: "AG" <NO**********@n ewsgroups.nospa m>
From: "AG" <NO**********@n ewsgroups.nospa m>
Reference s: <#m************ **@TK2MSFTNGP02 .phx.gbl>
<OH********** ****@TK2MSFTNGH UB02.phx.gbl>
<uL********** ****@TK2MSFTNGP 05.phx.gbl>
<Z9********** ****@TK2MSFTNGH UB02.phx.gbl>
<ON********** ***@TK2MSFTNGP0 6.phx.gbl>
<9T********** ***@TK2MSFTNGHU B02.phx.gbl>
Subject: Re: Web Application Project - ReportViewer Control
Date: Fri, 24 Aug 2007 11:29:16 -0400
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Message-ID: <uC************ **@TK2MSFTNGP04 .phx.gbl>
Newsgroup s: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: ool-44c55ef0.dyn.op tonline.net 68.197.94.240
Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP04.phx .gbl
Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.p ublic.dotnet.fr amework.aspnet: 39678
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Thanks Steven,

This looks promising, but I am having some trouble understanding it.
Could you please repeat it in VB and explain the origin of the object
sources (rpt_tableTable Adapter, etc) a bit more.
I have looked at help for table adapters and the examples are similar,
but
>>>>still confusing.

--

AG
Email: discuss at adhdata dot com
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:9T**** ***********@TK2 MSFTNGHUB02.phx .gbl...
Thanks for your followup AG,
>
So in your scenario, those Business class has already been well
defined
and
only return DataTable, dataset objects, right?
>
I've performed some further research and I suggest you consider the
following workaround:
>
** You can still keep the original business class's methods that
return
DataTable , however, you can add a new method which return the typed
DataRow
array. e.g. (the "GetDataRecords " method in the below class)
>
=========== =============== =
public class MyDataSource
{
public TDS.rpt_tableDa taTable GetDataTable()
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAda pters.rpt_table TableAdapter();
>
TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();
>
ta.Fill(table);
>
return table;
}
>
public TDS.rpt_tableRo w[] GetDataRecords( )
{
TDSTableAdapter s.rpt_tableTabl eAdapter ta = new
TDSTableAda pters.rpt_table TableAdapter();
>
TDS.rpt_tableDa taTable table = new TDS.rpt_tableDa taTable();
>
ta.Fill(table);
>
TDS.rpt_tableRo w[] rows = new
TDS.rpt_tab leRow[table.Rows.Coun t];
>
table.Rows.Copy To(rows, 0);
>
return rows;
}
>
>
}
=========== ============
>
>
** Thus, at development time, you can see the class and design the
report
by the typedDataRow's properties in "Website data source" window. At
runtime, you can change the datasource back to use the original
method(whic h return DataTable)
>
How do you think?
>
Sincerely ,
>
Steven Cheng
>
Microsoft MSDN Online Support Lead
>
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
>
>




Sep 2 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7721
by: Raghu | last post by:
I have developed a web portal that uses ReportViewer web control to connect to a remote SQL 2005 Report server and displays the reports on the client side. The asp.net page has been coded to automatically impersonate a specific user who has access to the report server so that the customer don't get a pop-up asking for login credentials. Once...
9
1253
by: Bill nguyen | last post by:
I'm working on a VB 05 project. I need to copy the project from my home's development machine to the PC at work so I can work in both places. I was able to do this with VS2003 but always got error "... appname.vbproj application not installed!" with 05' projects. I have VS05 installed in both machines. Thanks Bill
4
4464
by: Sevu | last post by:
I am working with ASP.NET.I am using ReportViwer Control to show my report.I like to add dropdownlist with in the reportviewer control. ( Not top to the control some thing like that).I need to place dropdown near to Export link ( Excel and PDF Export).Is it possible to add at the dropdown list with in report viewer control?. I found the...
1
17926
by: Rich | last post by:
Hello, I am trying to use the Reportviewer control. I have been following an example from the web, and the instructions from the help files on set up a ..rdlc and binding it to the reportviewer control. The help files state that in the form the contains the reportviewer control there is a tasks smart tags panel in design view. I don't...
0
2002
by: Rich | last post by:
Hello, I started using the Reportviewer control (very nice) for generating Reporting Services type reports in my VB2005 app. I have been experimenting using a designer Reportviewer control from the toolbox - created at design time - (VB2005) and also creating a Reportviewer control at runtime on the fly. The runtime Reportviewer will...
1
7181
by: Rich | last post by:
Hello, I am trying to deploy a VB2005 app which contains a ReportViewer control. I have added the Reportviewer control to the prerequisite list by click on Prerequisites in the Project/Properties/Publish/Prerequisites and select which prerequisite to install. I select Microsoft Visual Studio 2005 Report Viewer. I have then also selected...
1
2240
by: ajaykhedekar | last post by:
I am Showing Mulitple MSRS Reports on Single ASP.Net WEB Page using Mulitple ReportViewer Controls. If User wants to Print the Reports, then user has to click Print button provided by ReportViewer Control multiple times, So I want to do this with one button Click.This Button Click event will handle the Printing process of ReportViewer Control. ...
3
4247
by: Dean Slindee | last post by:
Using VS2005, I am deploying a WinForm application with ClickOnce. The project contains a ReportViewer2005 control, so there is a prerequisite for the ReportViewer2005.dll. The ReportViewer.dll that is included with Visual Studio 2005 works fine on my (developer) pc, both within Visual Studio 2005, and after deployed, from my pc. However,...
5
10330
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 I would like to add a checkbox or dropdown control to the .RLDC and have Item #1, Item #2, or Item #3 display conditionally based on a checkbox being...
0
7831
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7746
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8092
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8262
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8129
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5331
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3768
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1364
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.