ReportView + SQLDataSource (dinamically defined)

S

slY

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!
 
G

Gregory A. Beamer

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! |
*******************************************
 
S

slY

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!
 
S

slY

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top