Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ReportView + SQLDataSource (dinamically defined)

Reply
Thread Tools

ReportView + SQLDataSource (dinamically defined)

 
 
slY
Guest
Posts: n/a
 
      01-11-2010
hi all!

I'm trying to link a SQLDataSource to a Reportview dinamically in this way:

in Print.aspx I set

<rsweb:ReportViewer ID="RptViewFoo" runat="server" Font-Names="Verdana"
Font-Size="8pt"
Height="400px" Width="966px">
<LocalReport ReportPath="Print\Foo.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="SQLDSFoo" Name="Report_Foo" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:SqlDataSource ID="SQLDSFoo" runat="server" ConnectionString="<%$
ConnectionStrings:_FOO_ConnectionString %>"
></asp:SqlDataSource>



then, in the code behind I use code like

....
ElseIf (stampType = "Foo") Then
If Not (IDUser = "") Then
Try
SQLDSFoo.SelectParameters.Clear()
SQLDSFoo.SelectParameters.Add("id_user",
Type.GetTypeCode(Type.GetType("Integer")), IDUser) 'IDUser is loaded via
Query-String
SQLDSFoo.SelectCommand = "SELECT * FROM [PRINT_FOO] AS X WHERE
X.id_user = @id_user"
SQLDSFoo.Select(Nothing)
RptViewFoo.DataBind()

SQLDSFoo.UpdateParameters.Clear()
SQLDSFoo.UpdateParameters.Add("id_user",
Type.GetTypeCode(Type.GetType("Integer")), IDUser)
SQLDSFoo.UpdateCommand = "dbo.procedure_UDPATE_FOO_PRINTED @id_user"
...

Does it make sense?

Sorry, but I cannot use debug mode with this project!
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      01-11-2010
slY <(E-Mail Removed)> wrote in
news:eMq$(E-Mail Removed):

> hi all!
>
> I'm trying to link a SQLDataSource to a Reportview dinamically in this
> way:
>
> in Print.aspx I set
>
> <SNIPPED CODE>
>
> Does it make sense?



If you are going through the motions of customizing the data transport,
why would you want to use a SqlDataSource control. The idea behind
DataSource is you drag and drop, set and forget.

This blog entry might better explain why I am asking why you are doing
this:

http://bit.ly/8MCMDK

If you end up with a lot of customization, you might as well bite the
bullet and create a data layer rather than attempt to customize an "all
in one" control.

> Sorry, but I cannot use debug mode with this project!


Why?

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
slY
Guest
Posts: n/a
 
      01-11-2010
Il 11/01/2010 16.03, Gregory A. Beamer ha scritto:
> This blog entry might better explain why I am asking why you are doing
> this:
>
> http://bit.ly/8MCMDK
>

Thank you, I'm reading your article very carefully.

> If you end up with a lot of customization, you might as well bite the
> bullet and create a data layer rather than attempt to customize an "all
> in one" control.


At the moment I know what you mean, but I'm pretty new to ASP.NET
programming (and web programming in general), so please excuse the lack
of orthodoxy in the approach to the subject.


The fact is that the page return a PDF, so there is no interaction with
the user, even when updating! (I use UpdateCommand to launch a store
procedure that marks the involved records as printed...

The "business" of the page is defined entirely by the query-string,
covering four cases:

- two kinds of stamp (by default, when there is no user ID in the
query-string, all the users will be involved in the PDF report):

Print.aspx?stampType=kind_a
Print.aspx?stampType=kind_b


- the two kindx of stamp for the single user (in this case only the
single record related to the user will be printed):

Print.aspx?stampType=kind_a&IDUser=1
Print.aspx?stampType=kind_a&IDUser=2
Print.aspx?stampType=kind_a&IDUser=3
....

Print.aspx?stampType=kind_b&IDUser=1
Print.aspx?stampType=kind_b&IDUser=2
Print.aspx?stampType=kind_b&IDUser=3
....


Any suggestions or help will be appreciated!



 
Reply With Quote
 
slY
Guest
Posts: n/a
 
      01-15-2010
Il 11/01/2010 16.03, Gregory A. Beamer ha scritto:
> If you end up with a lot of customization, you might as well bite the
> bullet and create a data layer rather than attempt to customize an "all
> in one" control.


Any advise or article about how to face the design of a proper data layer?

Thank you very much.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEWBIE: RecordCount of SqlDataSource Daan ASP .Net 4 03-18-2009 11:04 AM
SqlDataSource - command timeout? Sasa . ASP .Net 3 02-15-2005 04:44 PM
Updating records using gridview, sqldatasource, and sproc =?Utf-8?B?UA==?= ASP .Net 1 11-30-2004 05:04 AM
Re: How to retrieve an Output Parameter using SQLDataSource Control Karl ASP .Net 2 09-07-2004 10:26 PM
Whidbey(v2.0.31113) OracleClient/SqlDataSource parameter binding Andrew ASP .Net 3 04-01-2004 05:13 PM



Advertisments