A doubt in DateTime field
Hi,
I did a program and in that part i have given a loop. This is a program which reads any xml schema file and according to their datatypes , It creates 200 values in a xml file. Each values should differ from the other. I have done it for other datatypes. But for DateTime, I dont know how to change the data, Pls have a look through and sent me. Its very urgent for me now. I ma sending the loop part alone and I will mark my dobtful part alone in bold . just give an idea how to do.
private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
for(int j = 0; j <= 200; j++)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0 ;
foreach (DataColumn dColmn in dTbl.Columns)
{
switch(dColmn.DataType.ToString())
{
case "System.String":
oValues[i] = (string) "This is string" + j;
break;
case "System.DateTime":
oValues[i] = new DateTime(2004,10,12) ;
break;
}
i = i+1;
}
dTbl.Rows.Add(oValues);
}
}
}
santhosh
__________________
SureShot
|