Linq query as datasource for reportviewer in VB.net

Encerrado Postado Apr 22, 2009 Pago na entrega
Encerrado Pago na entrega

I am an application programmer with 40+ years experience and am learning .net for a personal project. In this project I am trying to combine two popular .net technologies, Linq to SQL and ReportViewer.?

My goal is to have a single instance of reportviewer host multiple separately-deisgned report definitions (rdlc) and allow simple programmatic dataset manipulations (inclusions, exclusions, sorting, groupings, etc.) using Linq to SQL.?

So far, I have the Linq to SQL and multiple report aspects handled, but need some guidance or assistance on using the Linq query results as a datasource for the reportviewer, especially for database images.

## Deliverables

I am an application programmer with 40+ years experience and am learning .net for a personal project. In this project I am trying to combine two popular .net technologies, Linq to SQL and ReportViewer.?

My goal is to have a single instance of reportviewer host multiple separately-deisgned report definitions (rdlc) and allow simple programmatic dataset manipulations (inclusions, exclusions, sorting, groupings, etc.) using Linq to SQL.?

So far, I have the Linq to SQL and multiple report aspects handled, but need some guidance or assistance on using the Linq query results as a datasource for the reportviewer, especially for database images.

Language: Visual Basic

Environment: Visual Studio 2008 with .net 3.5

Database: SQL Server Compact 3.5 SP1

Report type: Local (windows form)

I am looking for a code sample I can follow, maybe a dozen lines of code or so, which demonstrate the following:

1. declare the necessary linq datacontext for the database and data objects (2 statements)

2. setup and execute the linq query (1 statement)

3. instantiate/reset a existing reportviewer control placed on a windows form by the form designer (1-2 statements)

4. point the reportviewer to the appropriate rdlc report (1 statement)

5. perform any necessary datatype conversions from the Linq query results to the datatype required by the rdlc report (? statements *)

6. setup the reportviewer datasource (1 statement)

7. execute the report (1 statement)

(*) My present hangup appears to be in the datatype conversion from the Linq query result to the specific object used to design the rdlc report.? The result is that images appear in the report as a small box with a red X.? ? I am hopeful that the answer may be as simple as posting a snippet of existing code, or a correction to my code as shown below. The following code sample is representative of what I have right now, and is not fully functional.? ?

'setup linq datacontext to database and get images table?

? ? ? ? Dim db As New DataContext([url removed, login to view])?

? ? ? ? Dim images As Table(Of PropImage) = [url removed, login to view](Of PropImage)()

'linq query to retrieve caption and image fields?

? ? ? ? Dim q = From i In images Select [url removed, login to view], [url removed, login to view]

'Reset reportviewer and define which report to print?

? ? ? ? [url removed, login to view]()?

? ? ? ? [url removed, login to view] = "[url removed, login to view]"

'define data source object name and value as datasources (this is where things are not working)?

? ? ? ? [url removed, login to view](New [url removed, login to view]("[url removed, login to view]", q))

'print the report?

? ? ? ? [url removed, login to view]()

Please be advised that my expectation is that this RFP will not require much (if any) programming time or research.? If you believe it will, please do not respond as you are probably not the person I'm looking for.? I understand that the reportviewer was designed for a 1:1 correspondence with rdlc reports, and there are many web references to multi-rdlc reportviewers.? What I am most interested in is how to use Linq query results to feed pre-designed rdlc reports based on existing dbml Linq objects already managed as project datasources.?

I believe the answer should be readily apparent to someone experienced with Linq and reportviewer, I just have not been able to find any answers in the forums or google.?

* * *This broadcast message was sent to all bidders on Wednesday Apr 22, 2009 4:28:11 PM:

Thanks for your interest in my posting. I had HTML problems sending my formatted VB code in messages so I have edited it into the description so it would be more legible. Sorry for the confusion. -BGood

* * *This broadcast message was sent to all bidders on Wednesday Apr 29, 2009 11:35:26 PM:

Dear bidders, Thank you for taking the time to respond to my Rent-A-Coder bid request. So far, I have received 3 bids of $60, $80, and $250. I feel either of the two lower bids are in the price ballpark, but I have not been provided with sufficient information to decide upon a bidder or understand fully what is being proposed. As this is my first use of the Rent-A-Coder system, please forgive my inexperience with the process, but in order for me to evaluate your bid relative to competing bids, I would like more information regarding your experience with the Linq and reportviewer technologies and how you plan to address the software requirements outlined in my project description. Specifically: 1) Have you successfully addressed this problem before? In other words, converted the generic collection returned as the result of Linq query to a strongly-typed dataset or object collection usable as a datasource for reportviewer in [url removed, login to view] 2) Assuming you have successfully addressed this problem before, regarding the code sample provided with my project description, please describe how you intend to address the software requirements outlined in my project description. Are minor revisions required to my code? How does your proposed solution differ from the code I have provided? Are you planning on providing an alternative code template that I will need to understand and modify? I have previously posted this problem in both Linq and reportviewer forums, but have not had any replies. I posted this proposal on Rent-A-Coder in the expectation that someone has addressed the problem before, and I am willing to pay for an expeditious solution. So if you have already gone through the process of getting Linq and reportviewer to work together, please state this explicitly in your proposal, and be specific about how you propose to address the project requirements, either by modifying the code I have provided or describing another solution that works. Thank you in advance for addressing these details. -BGood

* * *This broadcast message was sent to all bidders on Saturday May 16, 2009 4:31:31 PM:

Thanks to all of you who responded to my request for project assistance on [url removed, login to view], but a programming solution was obtained via MSDN. The contributor had previously addressed the Linq-ReportViewer combination and provided sample code which enabled my code to function with only slight modification. Although my impression is that each of the RAC respondants could have developed a successful solution, a code sample was exactly what I was looking for.

.NET Engenharia Microsoft MySQL PHP Gestão de projetos Arquitetura de software Teste de Software SQL Visual Basic Área de trabalho do Windows

ID do Projeto: #3828550

Sobre o projeto

3 propostas Projeto remoto Ativo em Jun 12, 2009

3 freelancers estão ofertando em média $111 nesse trabalho

jawadh

See private message.

$212.5 USD in 14 dias
(83 Comentários)
6.0
tony02

See private message.

$51 USD in 14 dias
(8 Comentários)
3.7
rungxanh252000

See private message.

$68 USD in 14 dias
(13 Comentários)
2.7