PC Review


Reply
Thread Tools Rate Thread

c# and mysql datetime

 
 
=?Utf-8?B?b3NjYXI=?=
Guest
Posts: n/a
 
      14th Jun 2005
currently i'm writing a ADO.Net program using C3 and mysql. i am using
crystal reports by running a mysql query into a DataSet and then using the
DataSet.WriteXMLSchema() function. The problem i'm having is that when i
write the xml schema the mysql datetime column shows up as:

<xs:element name="datesold" msdataataType="MySql.Data.Types.MySqlDateTime,
MySql.Data, Version=1.0.4.29851, Culture=neutral, PublicKeyToken=null"
type="xs:string" minOccurs="0" />

and crystal reports does not recognize it in the schema. Is there a way to
change the column?

i tried changing the column type in the dataset but can't change the type
after it's filled. i know i could copy all the data into a datatable, but
there are going to be about 20,000 records in the dataset, so i don't want to
dump the xml or have to run a loop to import it into a datatable.

thanks in advance for any help,
scott
 
Reply With Quote
 
 
 
 
Mark Ashton
Guest
Posts: n/a
 
      13th Aug 2005
When the DataSet was created the DataColumn.DataType was set to be
MySqlDateTime when it looks like you just want System.DateTime.

You should be able to either create the schema before filling the dataset
and convert the data from MySqlDateTime to DateTime on each row added or
after filling the dataset, add a new DateTime column, convert/copy all the
data, remove the MySqlDateTime column.

After that call DataSset.WriteXmlSchema.

For example, compare the output of
DataSet ds = new DataSet("DataSet");
ds.Tables.Add("Table").Columns.Add("Col1", typeof(System.DateTime));
ds.WriteXmlSchema(System.Console.Out);
vs
DataSet ds = new DataSet("DataSet");
ds.Tables.Add("Table").Columns.Add("Col1",
typeof(System.Data.OracleClient.OracleDateTime));
ds.WriteXmlSchema(System.Console.Out);



"oscar" <(E-Mail Removed)> wrote in message
news:BE2E00DB-09C6-408B-9E45-(E-Mail Removed)...
> currently i'm writing a ADO.Net program using C3 and mysql. i am using
> crystal reports by running a mysql query into a DataSet and then using the
> DataSet.WriteXMLSchema() function. The problem i'm having is that when i
> write the xml schema the mysql datetime column shows up as:
>
> <xs:element name="datesold"
> msdataataType="MySql.Data.Types.MySqlDateTime,
> MySql.Data, Version=1.0.4.29851, Culture=neutral, PublicKeyToken=null"
> type="xs:string" minOccurs="0" />
>
> and crystal reports does not recognize it in the schema. Is there a way to
> change the column?
>
> i tried changing the column type in the dataset but can't change the type
> after it's filled. i know i could copy all the data into a datatable, but
> there are going to be about 20,000 records in the dataset, so i don't want
> to
> dump the xml or have to run a loop to import it into a datatable.
>
> thanks in advance for any help,
> scott



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy way to convert datetime (mysql) Bobby Edward Microsoft ASP .NET 1 6th Nov 2008 04:04 AM
Formatting datetime problems importing data from mysql db =?Utf-8?B?UEVB?= Microsoft Excel Misc 2 23rd Feb 2006 11:04 PM
DateTime not serialized as ISO8601 if initialized from MySQL datetime rlaemmler@gmail.com Microsoft Dot NET Framework 0 28th Jan 2006 01:29 AM
DateTime not serialized as ISO8601 if initialized from MySQL datetime rlaemmler@gmail.com Microsoft ASP .NET 0 27th Jan 2006 03:50 PM
MySql DateTime =?Utf-8?B?S2VubmV0aCBQ?= Microsoft ASP .NET 2 15th Mar 2005 08:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:22 AM.