Results 1 to 3 of 3

Thread: CReating A DataTable structure with MySql DateTime

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Posts
    323

    CReating A DataTable structure with MySql DateTime

    Hi all,

    I'm having no luck finding info so I thought someone here might know.

    I am setting up a routine whereby I have to copy the results of a MySQL stored procedure into a DataTable so that I can add fields to the end of the result.

    Normally I would convert the Msql DateTime to something that I could more easily manipulate; however, the existing code that I have specifically addresses the MySql DateTime type in too many ways to easily change.

    So I thought I could do something like this:
    Code:
                myDataColumn = new DataColumn("ETD_DT");
                myDataColumn.DataType = System.Type.GetType("System.DateTime");
                returnDataTable.Columns.Add(myDataColumn);
    And substitute "MySqlData.Types.MySqlDateTime" for "SystemDateTime", but it fails with "Column Requires a Valid DataType".

    Any ideas?

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: CReating A DataTable structure with MySql DateTime

    I am not very familiar with MySQL in .Net but here is something I think may be worth looking at:
    Code:
    myDataColumn.DataType = System.Type.GetType("System.DateTime");
    myDataColumn.DataType = MySqlData.Types.GetType("MySqlData.Types.MySqlDateTime");
    I don't even know if it can be done or if that method even exists. If it does not, sorry for wasting your time.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: CReating A DataTable structure with MySql DateTime

    Hello,

    You may also want to try:

    Code:
    myDataColumn.DataType =  typeof(MySql.Data.Types.MySqlDateTime);
    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width