473,383 Members | 1,997 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,383 software developers and data experts.

Filling a Dataset and Dataset.WriteXML method..

hello there, i am writing a program that generates random numbers and shows
the numbers on a (x,y) chart.. i decided to use crystal reports to draw the
chart and a dataset.readxml to read data..
my problem is when i try to fil the dataset manually and type
dataset.writexml i find that theres nothing written on the xml file.. heres
the code i wrote.. please help me in this situation...

in form_load:

-----------------------------------------

ds = new DataSet();

ds.Tables.Add("numbers");

DataColumn dc = new DataColumn("number",Type.GetType("System.String")) ;

ds.Tables["numbers"].Columns.Add(dc);

-----------------------------------------

random number gneration and storing in dataset:

-----------------------------------------

Random r = new Random();

DataRow dr;

dr = ds.Tables[0].NewRow();

dr["numbers"] = r.NextDouble().ToString("0.#");

-----------------------------------------

and finally writing data to an xml file..

-----------------------------------------

ds.Tables[0].AcceptChanges();

ds.AcceptChanges();

ds.WriteXml("c:\\numbers.xml");

-----------------------------------------

thanx for spending your time on reading my post and have a nive year :)

p.s: visual basic 6.0 used to have a control for creating charts and i think
it was easier to use than crystal reports.. if u know a control in c# that i
can use please let me know..
Nov 16 '05 #1
3 1912
I don't see a dt.Rows.Add in your code. Even though you do a NewRow, the row
is still detached.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Serdar C" <se*****@interaktif.gen.tr> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
hello there, i am writing a program that generates random numbers and
shows
the numbers on a (x,y) chart.. i decided to use crystal reports to draw
the
chart and a dataset.readxml to read data..
my problem is when i try to fil the dataset manually and type
dataset.writexml i find that theres nothing written on the xml file..
heres
the code i wrote.. please help me in this situation...

in form_load:

-----------------------------------------

ds = new DataSet();

ds.Tables.Add("numbers");

DataColumn dc = new DataColumn("number",Type.GetType("System.String")) ;

ds.Tables["numbers"].Columns.Add(dc);

-----------------------------------------

random number gneration and storing in dataset:

-----------------------------------------

Random r = new Random();

DataRow dr;

dr = ds.Tables[0].NewRow();

dr["numbers"] = r.NextDouble().ToString("0.#");

-----------------------------------------

and finally writing data to an xml file..

-----------------------------------------

ds.Tables[0].AcceptChanges();

ds.AcceptChanges();

ds.WriteXml("c:\\numbers.xml");

-----------------------------------------

thanx for spending your time on reading my post and have a nive year :)

p.s: visual basic 6.0 used to have a control for creating charts and i
think
it was easier to use than crystal reports.. if u know a control in c# that
i
can use please let me know..

Nov 16 '05 #2
it works now thank you so much.
"Sahil Malik" <co*****************@nospam.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
I don't see a dt.Rows.Add in your code. Even though you do a NewRow, the row is still detached.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Serdar C" <se*****@interaktif.gen.tr> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
hello there, i am writing a program that generates random numbers and
shows
the numbers on a (x,y) chart.. i decided to use crystal reports to draw
the
chart and a dataset.readxml to read data..
my problem is when i try to fil the dataset manually and type
dataset.writexml i find that theres nothing written on the xml file..
heres
the code i wrote.. please help me in this situation...

in form_load:

-----------------------------------------

ds = new DataSet();

ds.Tables.Add("numbers");

DataColumn dc = new DataColumn("number",Type.GetType("System.String")) ;

ds.Tables["numbers"].Columns.Add(dc);

-----------------------------------------

random number gneration and storing in dataset:

-----------------------------------------

Random r = new Random();

DataRow dr;

dr = ds.Tables[0].NewRow();

dr["numbers"] = r.NextDouble().ToString("0.#");

-----------------------------------------

and finally writing data to an xml file..

-----------------------------------------

ds.Tables[0].AcceptChanges();

ds.AcceptChanges();

ds.WriteXml("c:\\numbers.xml");

-----------------------------------------

thanx for spending your time on reading my post and have a nive year :)

p.s: visual basic 6.0 used to have a control for creating charts and i
think
it was easier to use than crystal reports.. if u know a control in c# that i
can use please let me know..


Nov 16 '05 #3
Awesome !! :)
"Serdar C" <se*****@interaktif.gen.tr> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
it works now thank you so much.
"Sahil Malik" <co*****************@nospam.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
I don't see a dt.Rows.Add in your code. Even though you do a NewRow, the

row
is still detached.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Serdar C" <se*****@interaktif.gen.tr> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
> hello there, i am writing a program that generates random numbers and
> shows
> the numbers on a (x,y) chart.. i decided to use crystal reports to draw
> the
> chart and a dataset.readxml to read data..
> my problem is when i try to fil the dataset manually and type
> dataset.writexml i find that theres nothing written on the xml file..
> heres
> the code i wrote.. please help me in this situation...
>
> in form_load:
>
> -----------------------------------------
>
> ds = new DataSet();
>
> ds.Tables.Add("numbers");
>
> DataColumn dc = new DataColumn("number",Type.GetType("System.String")) ;
>
> ds.Tables["numbers"].Columns.Add(dc);
>
> -----------------------------------------
>
> random number gneration and storing in dataset:
>
> -----------------------------------------
>
> Random r = new Random();
>
> DataRow dr;
>
> dr = ds.Tables[0].NewRow();
>
> dr["numbers"] = r.NextDouble().ToString("0.#");
>
> -----------------------------------------
>
> and finally writing data to an xml file..
>
> -----------------------------------------
>
> ds.Tables[0].AcceptChanges();
>
> ds.AcceptChanges();
>
> ds.WriteXml("c:\\numbers.xml");
>
> -----------------------------------------
>
>
>
> thanx for spending your time on reading my post and have a nive year :)
>
> p.s: visual basic 6.0 used to have a control for creating charts and i
> think
> it was easier to use than crystal reports.. if u know a control in c# that > i
> can use please let me know..
>
>



Nov 16 '05 #4

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

Similar topics

4
by: Simon | last post by:
Hi all, I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset. The data set can contain 10's of tables, each with 100's of rows, and I have...
1
by: Wil | last post by:
I'm very new to developing in .NET and even newer to XML. The past few days have been pretty frustrating for me because I'm trying to perform a transform on data in a dataset and it's not working....
2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
3
by: Joe98765 | last post by:
I have data coming from SQL Server and need to write out some XML. I have a schema(xsd) for this XML file. Right now I am bringing in the DataSet and writing out the elements and attributes myself...
4
by: Pipo | last post by:
Hi, I fill myDataset from a Excel file. Then I do a myDataset.WriteXML("C:\MyXML.xml") So far everything goes as I want to. But I need a attribute when a node has a value e.g.: I get:
1
by: RS | last post by:
I have a dataset that was created from a XSD schema. I populate it with data and use WriteXml method to create XML document. Problem is XML tags come out in the order that is different from the...
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...
2
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup...
4
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a DataSet that I save as XML using the DataSet DataTable's WriteXml method. If I say XmlWriteMode.IgnoreSchema, it shows up great in Excel, but I can not reopen the file in my...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.