Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Thursday, March 8, 2012

Data Binding with ReportViewer Control to an Independent Data Table

Here is what I am trying to do. I am using ASP.NET 2.0. I have created a data set called Stocks data table called Data and put it in the App_Code folder. I am filling the data table from data in a csv file located on the web. I am populating the data table with the following code. This code works because I checked the record count and it shows 21 records for the Data data table.

publicstaticDataSet Convert() { WebClient Client =newWebClient(); Stream myStream = Client.OpenRead("http://mysite.com/table.csv"); StreamReader myStreamReader =newStreamReader(myStream); Stocks myStocks =newStocks(); string line = myStreamReader.ReadLine(); string allData = myStreamReader.ReadToEnd(); string[] rows = allData.Split("\r\n".ToCharArray()); foreach (string rin rows) { string[] items = r.Split(",".ToCharArray()); myStocks.Tables["Data"].Rows.Add(items); } return myStocks; }

I am trying to bind the data in this table to a report. I added a report to my project and selected the fields from the data table. I then added a ReportViewer control to the web form. I'm not sure how to configure the ObjectDataSource that is added to the web form after the ReportViewer control is added. It firsts asks to select business object. I have the following options. I'm not sure what to select.

Stocks

Stocks + DataTable

Stocks + DataRow

Stocks + DataRowChangeEvent

Stocks + DataRowChangeEventHandler

Next I need to define a data method. Not sure what option to select. I just want to bind the report to the data table and return the rows.

Any help would be appreciated. Thanks.

Weste

Once you drag and drop the report viewer in the aspx page, you will get a smart tag next to your report viewe. From that select the repot.rdlc.

Itr will automatically configure the object datasorce for you.

Did you design your report.rdlc using the dataset you created?

|||

Yes, that is what I already tried and it didn't work. It didn't configure the datasource correctly. I received the following error.

An error has occurred during report processing.
The type specified in the TypeName property of ObjectDataSource 'ObjectDataSource1' could not be found.

This is the code that was automatically added after I added the ReportViewer

<asp:ObjectDataSourceID="ObjectDataSource1"runat="server"SelectMethod="GetData"

TypeName="StcoksTableAdapters."></asp:ObjectDataSource>

I'm not sure how to configure the ObjectDataSource that is added to the web form after the ReportViewer control is added. It firsts asks to select business object. I have the following options. I'm not sure what to select.

Stocks

Stocks + DataTable

Stocks + DataRow

Stocks + DataRowChangeEvent

Stocks + DataRowChangeEventHandler

It then asks me to choose a method. Some of the available options are

Clone(), returns DataSet
Copy(), returns DataSet
CreateDataReader(), returns DataTableReader

I have done other reports using a SQL datasource and they work fine. It works somewhat different without a SQL datasource. I am having trouble finding any documentation to assist me. Thanks for your help.

Weste

|||

I resolved the issue. I added a class called StockData. I moved the code for the Convert procedure into this class. I then configured the ObjectDataSource as follows:

Business Object: StockData
Select Method: Convert(), returns DataSet

Wednesday, March 7, 2012

Data base growth control

Please anybody can explain how to reduce MDF LDF files size
or tuneup the MS SQL Server

Quote:

Originally Posted by Ashutosh Keskar

Please anybody can explain how to reduce MDF LDF files size
or tuneup the MS SQL Server


I'm not absolutely sure what you're after but you can change the size and growth properties of both files in Enterprise Manager: right click on the database -> Properties -> Data files and Transaction Log tab.|||Hi Ashutosh Keskar and welcome to TSDN MSSQL Forum,

You can also take a look at the maintenance plan - Enterprise manager -> Server -> Management -> Database Maintenance and see if you are running a job to reorg the data and index pages( may be part of your backup), there is also an option to free unused space.

I cannot guarantee it will help (there is a small chance it could make performance worse) but it is worth a look.

Regards Purple

Tuesday, February 14, 2012

Customizing Report Parameter control; handling "available values"

I have a report that I show a bill of material based on a selected
parent. I have about 17,000 parents to select from. When I use
"available values from query" the current behavior on the report is a
drop down box where I can choose between all 17,000 where at least for
large collections I'd prefer being able to start typing in and have the
control filter the query based on what's typed into the parameter. Is
there a way to do this?Hi Benjamin.
I believe what you're looking for can be accomplished with a custom
parameter page. There is no way I know of with reporting services to
provide narrowing filter functionality out of the box.
"Benjamin Chan" <benjamin.no.spam.chan@.controlproductsinc.com> wrote in
message news:u1CkX$$gGHA.5096@.TK2MSFTNGP02.phx.gbl...
>I have a report that I show a bill of material based on a selected parent.
>I have about 17,000 parents to select from. When I use "available values
>from query" the current behavior on the report is a drop down box where I
>can choose between all 17,000 where at least for large collections I'd
>prefer being able to start typing in and have the control filter the query
>based on what's typed into the parameter. Is there a way to do this?