Answered by:
Writing SQL Query to load the data into RDLC Reports!

Question
-
Hi folks!Is there any way that I could pass the data by using SQL Query or applying query to the dataset which is used in my .rdlc file?For example: SELECT * FROM EmployeeTable WHERE EmployeeID='"+txtEmployee.Text.Trim()+"'.Any suggestions would be appreciated.Thanks and regards,V
Answers
-
What do you mean pass? Is you RDLC report wrapped in a .Net assembly or a COM object? Just execute the query using SqlCommand, SqlConnection, and SqlDataAdapter objects ( OleDb objects if you are not using Sql Server ) and fill your dataset/datatable.
From there you can either bind the dataset/datatable to the report's data source property or if the report cannot interface with .Net objects you can serialize the dataset/datatable to an XML file for your report to comsume.- Marked as answer by Harry Zhu Friday, September 11, 2009 2:35 AM
All replies
-
-
You can bind the RDLC to a object datasource and map the object datasource to a static function that returns type Employee, and pass the fileters.
<asp:ObjectDataSource ID="EmployeeDetailsObjectDataSource" runat="server" TypeName="urNamespace.Employee" SelectMethod="GetEmployee" <SelectParameters> <asp:Parameter Name="EmployeeID" /> </SelectParameters> <InsertParameters> </asp:ObjectDataSource>
Alternativly, you can use Datasets to bind it to report- Proposed as answer by Sabyasachi_1986 Friday, September 4, 2009 1:25 PM
-
What do you mean pass? Is you RDLC report wrapped in a .Net assembly or a COM object? Just execute the query using SqlCommand, SqlConnection, and SqlDataAdapter objects ( OleDb objects if you are not using Sql Server ) and fill your dataset/datatable.
From there you can either bind the dataset/datatable to the report's data source property or if the report cannot interface with .Net objects you can serialize the dataset/datatable to an XML file for your report to comsume.- Marked as answer by Harry Zhu Friday, September 11, 2009 2:35 AM
-
Hi! Michale can u show me a code example of above reply! I only want to pass sql query to rdlc report to load data dynamically. I've used ur above suggestion without any success. would appreciate any help here.
www.sudokuonweb.com