Click here to Skip to main content
15,889,335 members
Home / Discussions / C#
   

C#

 
GeneralRe: Datasets - performing selects Pin
Dimitris Iliopoulos18-Jun-03 5:10
Dimitris Iliopoulos18-Jun-03 5:10 
GeneralRe: Datasets - performing selects Pin
Oleksandr Kucherenko18-Jun-03 3:26
Oleksandr Kucherenko18-Jun-03 3:26 
GeneralDatasets - Adding columns Pin
MrEyes18-Jun-03 2:03
MrEyes18-Jun-03 2:03 
GeneralRe: Datasets - Adding columns Pin
Oleksandr Kucherenko18-Jun-03 3:36
Oleksandr Kucherenko18-Jun-03 3:36 
GeneralRe: Datasets - Adding columns Pin
MrEyes18-Jun-03 4:17
MrEyes18-Jun-03 4:17 
GeneralRe: Datasets - Adding columns Pin
Oleksandr Kucherenko18-Jun-03 4:43
Oleksandr Kucherenko18-Jun-03 4:43 
GeneralRe: Datasets - Adding columns Pin
MrEyes18-Jun-03 4:50
MrEyes18-Jun-03 4:50 
GeneralRe: Datasets - Adding columns Pin
MrEyes18-Jun-03 5:21
MrEyes18-Jun-03 5:21 
Well here it is, this piece of code will take a dataset (dsSource) add a column and write the results into a second dataset (dsNew).

Its dirty, it aint pretty, but it does the job (ish)

<br />
DataRow[] rows = new DataRow[ dsSource.Tables[0].Rows.Count ];<br />
dsSource.Tables[0].Rows.CopyTo(rows, 0);<br />
ArrayList lst = new ArrayList( rows);<br />
DataSet dsNew = new DataSet();<br />
dsNew.Tables.Add();<br />
<br />
for (int i=0; i<dsSource.Tables[0].Rows[0].ItemArray.Length + 1; i++)<br />
	dsNew.Tables[0].Columns.Add();<br />
<br />
foreach(DataRow drs in lst)<br />
{<br />
	ArrayList lst2 = new ArrayList(drs.ItemArray);<br />
	lst2.Insert(3, "INSERT VALUE");	//can be null						<br />
	DataRow ndr = dsNew.Tables[0].NewRow();<br />
	ndr.ItemArray = lst2.ToArray();												<br />
	dsNew.Tables[0].Rows.Add(ndr);<br />
}<br />


EDIT : hmm, the code tags seem to have messed up that for loop it should be :

for (int i=0; i
GeneralMultiple Events Pin
Anonymous18-Jun-03 0:52
Anonymous18-Jun-03 0:52 
GeneralListView Column Resize Pin
somanath17-Jun-03 23:44
somanath17-Jun-03 23:44 
GeneralSmtpMail.Send exception Pin
EnkelIk17-Jun-03 23:16
EnkelIk17-Jun-03 23:16 
GeneralRe: SmtpMail.Send exception Pin
EnkelIk18-Jun-03 0:53
EnkelIk18-Jun-03 0:53 
GeneralRe: SmtpMail.Send exception Pin
EnkelIk18-Jun-03 1:43
EnkelIk18-Jun-03 1:43 
GeneralRe: SmtpMail.Send exception Pin
EnkelIk18-Jun-03 21:39
EnkelIk18-Jun-03 21:39 
GeneralRe: SmtpMail.Send exception Pin
EnkelIk22-Jun-03 20:38
EnkelIk22-Jun-03 20:38 
Questionhow to view property of a file in terms of coding Pin
puppiesLover17-Jun-03 22:49
puppiesLover17-Jun-03 22:49 
AnswerRe: how to view property of a file in terms of coding Pin
nfactorial17-Jun-03 23:11
nfactorial17-Jun-03 23:11 
QuestionHow can one call a script function from a C# WebBrowser Application? Pin
Alberto Colon17-Jun-03 17:12
Alberto Colon17-Jun-03 17:12 
Generalchange icon at runtime Pin
albean17-Jun-03 15:54
albean17-Jun-03 15:54 
QuestionA .Net way to do PostMessage()? Pin
mcgahanfl17-Jun-03 15:41
mcgahanfl17-Jun-03 15:41 
AnswerRe: A .Net way to do PostMessage()? Pin
Oleksandr Kucherenko17-Jun-03 21:20
Oleksandr Kucherenko17-Jun-03 21:20 
GeneralRe: A .Net way to do PostMessage()? Pin
dynamic17-Jun-03 22:07
dynamic17-Jun-03 22:07 
GeneralRe: A .Net way to do PostMessage()? Pin
mcgahanfl18-Jun-03 3:04
mcgahanfl18-Jun-03 3:04 
GeneralNew to C# - API Usage Pin
User 665817-Jun-03 14:09
User 665817-Jun-03 14:09 
GeneralRe: New to C# - API Usage Pin
Jim Stewart17-Jun-03 15:25
Jim Stewart17-Jun-03 15:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.