473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How can i use a dataset w/o a datasource?

what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.

it was recommended, on here, that i create a dataset in memory and add
that to the report. i'm not sure how to do that at this point without
a datasource. i'm drawing a blank.

thanks to all who reply....

-
fd
Jan 10 '08 #1
5 2658
"forest demon" <me********@gmail.comwrote in message
news:f1**********************************@u10g2000 prn.googlegroups.com...
what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.

it was recommended, on here, that i create a dataset in memory and add
that to the report. i'm not sure how to do that at this point without
a datasource. i'm drawing a blank.
Simply build the dataset step by step by adding to its collections in
your code:

DataSet ds = new DataSet();
DataTable dt = new DataTable("name");
ds.Tables.Add(dt);
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(int));
dt.Rows.Add(new object[]{"value1", 123});
dt.Rows.Add(new object[]{"value2", 456});
//Now ds is a dataset that contains one table with two columns and two rows
Jan 10 '08 #2
On Jan 9, 11:25*pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.orgwrote:
"forest demon" <mete.ha...@gmail.comwrote in message

news:f1**********************************@u10g2000 prn.googlegroups.com...
what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.
it was recommended, on here, that i create a dataset in memory and add
that to the report. *i'm not sure how to do that at this point without
a datasource. *i'm drawing a blank.

* * Simply build the dataset step by step by adding to its collectionsin
your code:

DataSet ds = new DataSet();
DataTable dt = new DataTable("name");
ds.Tables.Add(dt);
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(int));
dt.Rows.Add(new object[]{"value1", 123});
dt.Rows.Add(new object[]{"value2", 456});
//Now ds is a dataset that contains one table with two columns and two rows
thanks for the input. i'm able to make this work now....

Jan 10 '08 #3
On Jan 9, 11:25*pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.orgwrote:
"forest demon" <mete.ha...@gmail.comwrote in message

news:f1**********************************@u10g2000 prn.googlegroups.com...
what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.
it was recommended, on here, that i create a dataset in memory and add
that to the report. *i'm not sure how to do that at this point without
a datasource. *i'm drawing a blank.

* * Simply build the dataset step by step by adding to its collectionsin
your code:

DataSet ds = new DataSet();
DataTable dt = new DataTable("name");
ds.Tables.Add(dt);
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(int));
dt.Rows.Add(new object[]{"value1", 123});
dt.Rows.Add(new object[]{"value2", 456});
//Now ds is a dataset that contains one table with two columns and two rows
should i cast the value prior to adding it to the row?
if not, i get the DataRow type when trying to use the text value in
the array.

thanks...
Jan 10 '08 #4
On Jan 10, 12:22*am, forest demon <mete.ha...@gmail.comwrote:
On Jan 9, 11:25*pm, "Alberto Poblacion" <earthling-

quitaestoparacontes...@poblacion.orgwrote:
"forest demon" <mete.ha...@gmail.comwrote in message
news:f1**********************************@u10g2000 prn.googlegroups.com...
what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.
it was recommended, on here, that i create a dataset in memory and add
that to the report. *i'm not sure how to do that at this point without
a datasource. *i'm drawing a blank.
* * Simply build the dataset step by step by adding to its collections in
your code:
DataSet ds = new DataSet();
DataTable dt = new DataTable("name");
ds.Tables.Add(dt);
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(int));
dt.Rows.Add(new object[]{"value1", 123});
dt.Rows.Add(new object[]{"value2", 456});
//Now ds is a dataset that contains one table with two columns and two rows

should i cast the value prior to adding it to the row?
if not, i get the DataRow type when trying to use the text value in
the array.

thanks...- Hide quoted text -

- Show quoted text -
oh geesh...nevermind. i figured it out. sorry....

thanks again for your help. i do appreciate it.

-
fd
Jan 10 '08 #5

You can also create a (strongly typed) dataset. And get strong typing.

Start a new Console Application:

Add / New Item / DataSet.

Call it "EmployeeDS". (or EmployeeDS.xsd)

Right click (in the design area) ... Add a table. "Employee"

Add 3 columns

ID (int)
LastName (string)
FirstName (string)
...
then you can "code up" a version like this

EmployeeDS ds = new EmployeeDS();

//first way
ds.Employee.AddNewEmployeeRow ( 123, "Smith" , "John");
//second way
EmployeeDS.Employee.EmployeeRow newRow = ds.Employee.NewEmployeeRow();
newRow.ID = 234;
newRow.LastName = "Jones";
newRow.FirstName = "Mary";

ds.Employee.AddNewEmployeeRow ( newRow ) ;

string x = ds.GetXml();
I do that all the time for UnitTests, and testing code without talking to
the database.

Good luck.


"forest demon" <me********@gmail.comwrote in message
news:f1**********************************@u10g2000 prn.googlegroups.com...
what i'm trying to do is attach a report file to a reportviewer
instance with some values from a page. i can attach a dataset to
the .rdlc file with stuff from a datasource, but i need to also add
values form a pages web controls to the same report.

it was recommended, on here, that i create a dataset in memory and add
that to the report. i'm not sure how to do that at this point without
a datasource. i'm drawing a blank.

thanks to all who reply....

-
fd

Jan 10 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Scott | last post by:
I was just wondering if it's possible to cast a datagrid DataSource as a DataSet? I've stepped through my code when the grid is first being bound and the DataSource shows up as a DataSet for the...
4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
3
by: MajorTom | last post by:
Hello everybody, I need help on how to use the same datase in two different form, this is the scenario: at the first form I load a big dataset (ds1) for short, but I not want to load it again...
2
by: Bennett Haselton | last post by:
I know how to create a DataAdapter that loads data from a data source into a table in a typed DataSet, and how to set the DataSource and DataMember properties of a DataGrid so that at run time it...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
3
by: neeraj | last post by:
Hi Every body I m not able to get dataset or datatable from datagrid. Now I m trying this code but this is always returns nothing. Private Sub Button1_Click(ByVal sender As System.Object, ByVal...
1
by: Mac | last post by:
I'm trying to validate input from an xml source to a dataset in dotnet2.0. As far as I can see, type errors correctly cause an exception, but values that are the correct type but do not satisify...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: =?Utf-8?B?UGFvbG8=?= | last post by:
Using a typed Dataset. From debugging I can see that each dataset.<tableis filled with the correct data (see ###) cmbxPayee DisplayMember, ValueMember and DataSource each show the expected...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.