Re: Convert a dataset to an array
From: Miha Markic [MVP C#] (miha)
Date: 03/15/04
- Next message: Nadav: "COM Interop problem"
- Previous message: Pete Davis: "Re: Hardware requirements"
- In reply to: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Next in thread: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Reply: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 15 Mar 2004 16:00:24 +0100
Hi Alvin,
What kind of array? Object[]?
Does DataRow.ItemArray help?
You have still loop through all the rows, though.
-- Miha Markic [MVP C#] - DXSquad/RightHand .NET consulting & software development miha at rthand com www.rthand.com Developer Express newsgroups are for peer-to-peer support. For direct support from Developer Express, write to support@devexpress.com Bug reports should be directed to: support@devexpress.com Due to newsgroup guidelines, DX-Squad will not answer anonymous postings. "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message news:uI1gKupCEHA.2576@TK2MSFTNGP11.phx.gbl... > I'm not trying to serialize. I'm trying to load data into a component. The > component accepts 1D arrays. The data source is a dataset. I'd like to put > the two together elegantly. > > -- > Regards, > Alvin Bruney [ASP.NET MVP] > Got tidbits? Get it here... > http://tinyurl.com/3he3b > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:u4J1NImCEHA.3132@TK2MSFTNGP11.phx.gbl... > > Hi Alvin, > > > > I am not sure what you are after. > > DataSet can be serialized (always as XML). > > A better result you will achieve by using this stuff: > > True Binary Serialization And Compression of DataSets > > http://www.eggheadcafe.com/articles/20031219.asp > > > > -- > > Miha Markic [MVP C#] - RightHand .NET consulting & software development > > miha at rthand com > > www.rthand.com > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message > > news:%23ywtOMlCEHA.1588@tk2msftngp13.phx.gbl... > > > Surely, there must exist an elegant way to flatten a dataset into a 1D > > > array. I cannot believe that the only way accomplish this is to loop > thru > > > the rows in the dataset. Yuck!!! > > > > > > This is what i tried > > > DataSet ds = loadData(); > > > ds.Tables[0].Rows.CopyTo(str,0); //bombout here > > > > > > next... > > > > > > DataColumnCollection dc = ds.Tables[0].Columns; > > > string[] columns = new string[dc.Count]; > > > dc.CopyTo(columns, 0); //bombout here > > > strHead = String.Join(",", columns); > > > > > > I believe the bombout is because of the system.dbnull which a dataset > > allows > > > however, i'm not sure. I'd like to use one of these approaches. I > > absolutely > > > hate this > > > for(int i = 0; i < ds.Tables[0].Rows.Count; i++) > > > StringBuilderVal.Append(",").Append( blah blah blah Yuck!!! > > > > > > private DataSet loadData() > > > { > > > DataSet dsTemp = new DataSet(); > > > DataTable Tables = new DataTable(); > > > dsTemp.Tables.Add(Tables); > > > dsTemp.Tables[0].Columns.Add( "test", System.Type.GetType( > > > "System.String" ) ); > > > > > > for(int col = 0; col < 10; col++) > > > { > > > DataRow myRow = dsTemp.Tables[0].NewRow(); > > > myRow[0] = col.ToString(); > > > dsTemp.Tables[0].Rows.Add(myRow); > > > } > > > return dsTemp; > > > } > > > > > > Anybody? > > > > > > -- > > > Regards, > > > Alvin Bruney [ASP.NET MVP] > > > Got tidbits? Get it here... > > > http://tinyurl.com/3he3b > > > > > > > > > > > >
- Next message: Nadav: "COM Interop problem"
- Previous message: Pete Davis: "Re: Hardware requirements"
- In reply to: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Next in thread: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Reply: Alvin Bruney [MVP]: "Re: Convert a dataset to an array"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|