Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2004, 12:42 AM
Authorized User
 
Join Date: Dec 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old December 30th, 2004, 01:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am not sure I understand the problem. Are you getting an error?

And what exactly are you trying to achieve? What's wrong with

new DateTime(2004,10,12);

Please elaborate a bit about what you're trying to accomplish.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Use DateTime Field kcsathish ASP.NET 2.0 Professional 0 July 15th, 2008 01:01 AM
Datetime Field as index daworm MySQL 2 September 17th, 2006 11:33 PM
Text to DateTime Field lenredles SQL Server 2000 1 March 6th, 2006 10:09 PM
How do you search datetime field? SoC Classic ASP Basics 6 October 31st, 2004 09:39 PM
Searching datetime field SoC Classic ASP Databases 2 October 29th, 2004 10:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.