Click here to Skip to main content
15,911,890 members
Home / Discussions / C#
   

C#

 
GeneralGentle.NET and Cascade Deletes Pin
devvvy4-Jan-05 23:46
devvvy4-Jan-05 23:46 
GeneralRe: Gentle.NET and Cascade Deletes Pin
Paul Ingles5-Jan-05 0:58
Paul Ingles5-Jan-05 0:58 
GeneralRe: Gentle.NET and Cascade Deletes Pin
devvvy5-Jan-05 3:45
devvvy5-Jan-05 3:45 
Generalc# GDI+ Photoshop like filters Pin
vansen4-Jan-05 23:37
vansen4-Jan-05 23:37 
GeneralRe: c# GDI+ Photoshop like filters Pin
Nick Parker5-Jan-05 8:02
protectorNick Parker5-Jan-05 8:02 
GeneralCreating Interop Wrapper Pin
DHARMA.R4-Jan-05 23:23
DHARMA.R4-Jan-05 23:23 
GeneralRe: Creating Interop Wrapper Pin
Paul Ingles4-Jan-05 23:40
Paul Ingles4-Jan-05 23:40 
Generalerror shown while working on xmltextreader Pin
dhol4-Jan-05 23:06
dhol4-Jan-05 23:06 
Hi
I have to read any schema file, and according to their datatype, it should load values for about 200 into a new xml file.

ie, a rough xml(first file -resulatant file)
<name>john1</name>
<salary>8100</salary>
<name>john2</name>
<salary>8200</salary>
<name>john3</name>
<salary>8300</salary>
<name>john4</name>
<salary>8400</salary>
like so on.. for about 200 values.

Now I have another xml file which has same "name" field all meaningful values for about 50.
(second xml file)
<name>john milton</name>
<name>stephen</name>
<name>george</name>
<name>thomas</name>
<name>paul</name> like so on for about 50 data's.

Now coming to my program, when it reads the schema, and when the schema file has the field"name" then it should read the second file and insert the data's from second file into the first xml (resultant file) for that particular field.

This is my requirement.
and this is my coding done, after running this program, i find that an error showing as "An unhandled exception system.argument exception occured"
please explain why is it occuring and how to rectify it.
Here is that part of the coding


private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0;
XmlTextReader xtr = new XmlTextReader("C:\\CDEV\\testdatagenerator\\billtoname.xml");
while(xtr.Read())
{
foreach (DataColumn dColmn in dTbl.Columns)
{
oValues[i] = "";
if((xtr.NodeType == XmlNodeType.Element) && (xtr.Name == dColmn.ColumnName.ToString()))
{
switch(dColmn.DataType.ToString())
{
case "System.String":
oValues[i] = (string) "sachin" + i;
break;
case "System.Int32":
oValues[i] = (int) 100 + i;
break;
case "System.DateTime":
oValues[i] = new DateTime(2004,01,30).AddDays(i * 1);
break;
case "System.Decimal":
oValues[i] = new Decimal(10000900.99) + i;
break;
case "System.Int16":
oValues[i] = (short) 32767 - i;
break;
case "System.Int64":
oValues[i] = (long) 400 - i;
break;
case "System.Double":
oValues[i] = (double) 888888 - i;
break;
case "System.Single":
oValues[i] = (float) 4.5f + i;
break;
}
}
}
}
i = i+1;
dTbl.Rows.Add(oValues);
}
}


private void button3_Click(object sender, System.EventArgs e)
{
dataSet1.WriteXml(txtXml.Text,XmlWriteMode.IgnoreSchema );
MessageBox.Show("Saved");
}
}
}
GeneralRe: error shown while working on xmltextreader Pin
exhaulted5-Jan-05 0:09
exhaulted5-Jan-05 0:09 
GeneralInstalling and Starting Services Pin
exhaulted4-Jan-05 22:55
exhaulted4-Jan-05 22:55 
GeneralOle Automation Pin
Jason Xie4-Jan-05 21:29
Jason Xie4-Jan-05 21:29 
GeneralRe: Ole Automation Pin
Heath Stewart4-Jan-05 21:56
protectorHeath Stewart4-Jan-05 21:56 
GeneralDifference between build and rebuild Pin
steve_rm4-Jan-05 20:34
steve_rm4-Jan-05 20:34 
GeneralRe: Difference between build and rebuild Pin
Heath Stewart4-Jan-05 21:36
protectorHeath Stewart4-Jan-05 21:36 
GeneralAsynchronous design question Pin
Yaakov Davis4-Jan-05 20:01
Yaakov Davis4-Jan-05 20:01 
GeneralRe: Asynchronous design question Pin
jan larsen4-Jan-05 21:14
jan larsen4-Jan-05 21:14 
GeneralRe: Asynchronous design question Pin
Yaakov Davis4-Jan-05 22:47
Yaakov Davis4-Jan-05 22:47 
GeneralRe: Asynchronous design question Pin
jan larsen4-Jan-05 22:57
jan larsen4-Jan-05 22:57 
GeneralRe: Asynchronous design question Pin
Yaakov Davis5-Jan-05 2:38
Yaakov Davis5-Jan-05 2:38 
GeneralRe: Asynchronous design question Pin
jan larsen5-Jan-05 3:28
jan larsen5-Jan-05 3:28 
GeneralC# hangs while opening word in web application Pin
NituP4-Jan-05 19:53
NituP4-Jan-05 19:53 
GeneralRe: C# hangs while opening word in web application Pin
Heath Stewart4-Jan-05 21:53
protectorHeath Stewart4-Jan-05 21:53 
Generalmdi strange problem Pin
Gavin Jeffrey4-Jan-05 19:13
Gavin Jeffrey4-Jan-05 19:13 
QuestionDistributed System in &quot;Javaspaces-Style&quot;?? Pin
stumpi4-Jan-05 16:50
stumpi4-Jan-05 16:50 
AnswerRe: Distributed System in &quot;Javaspaces-Style&quot;?? Pin
Heath Stewart4-Jan-05 21:52
protectorHeath Stewart4-Jan-05 21:52 

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.