473,788 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2677
"forest demon" <me********@gma il.comwrote in message
news:f1******** *************** ***********@u10 g2000prn.google groups.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(d t);
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-
quitaestoparaco ntes...@poblaci on.orgwrote:
"forest demon" <mete.ha...@gma il.comwrote in message

news:f1******** *************** ***********@u10 g2000prn.google groups.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(d t);
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-
quitaestoparaco ntes...@poblaci on.orgwrote:
"forest demon" <mete.ha...@gma il.comwrote in message

news:f1******** *************** ***********@u10 g2000prn.google groups.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(d t);
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...@gma il.comwrote:
On Jan 9, 11:25*pm, "Alberto Poblacion" <earthling-

quitaestoparaco ntes...@poblaci on.orgwrote:
"forest demon" <mete.ha...@gma il.comwrote in message
news:f1******** *************** ***********@u10 g2000prn.google groups.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(d t);
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...nevermi nd. 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.Add NewEmployeeRow ( 123, "Smith" , "John");
//second way
EmployeeDS.Empl oyee.EmployeeRo w newRow = ds.Employee.New EmployeeRow();
newRow.ID = 234;
newRow.LastName = "Jones";
newRow.FirstNam e = "Mary";

ds.Employee.Add NewEmployeeRow ( 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********@gma il.comwrote in message
news:f1******** *************** ***********@u10 g2000prn.google groups.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
1490
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 datagrid. Then, when I handle on OnClick event for an image button and the page posts back, I look at the DataSource for the grid and it says it's null. Is there any way of getting the grid's current datasource after it loads? I've tried...
4
2850
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
1533
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 at the second form at some point I use a second form Form f = new FormX(); f.ShowDialog();
2
8880
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 will load the data from that table in the DataSet. Assuming I've got two tables in the DataSet, how can I set the DataSource property of the DataGrid to be an inner join of the two tables in the DataSet? If I want the DataGrid to get data...
4
3754
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 and username, password etc will be exactly the same for each server, the only thing that will change is the server name. Idealy I would like to get the server names from a seperate dataset so there could be any number of servers, allthough in...
17
2771
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 allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
3
8408
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 e As System.EventArgs) Handles Button1.Click Dim tbl As New DataTable Dim ds As New DataSet
1
3632
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 xsd:restriction conditions are ingested without a murmur. Is this a bug or a feature? Very frustrating. Evidence: 1) XML data <?xml version="1.0" encoding="utf-8"?>
4
5936
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 them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
1131
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 values (see <---) cmbxCategory DisplayMember and ValueMember show expected values but DataSource shows null (see ***)
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.