Not sure this is your problem, but do you have the "Allow zero datetime" option on your connect string? For example,
connectionString="Server=localhost; User ID=some_user; Password=some_password; Database=some_database; Pooling=false; Allow Zero Datetime=true;" Thanks, Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-4396 -----Original Message----- From: Jesse [mailto:[EMAIL PROTECTED] Sent: Friday, December 01, 2006 4:45 PM To: MySQL List Subject: MySQL Date Issues OK, I'm about to pull my hair out with this one. I know it's simple, but I can't find a way to do this other than switching it to a string and parsing it out manually (something I should have to be forced to do). I've got a simple MySQL Table with a DateTime field in it. I want to display it as separate fields in a DataGrid, so I've got a column like this in there: <asp:TemplateColumn> <HeaderTemplate><b>Date</b></HeaderTemplate> <ItemTemplate> <%# Container.DataItem("StartDateTime") %> </ItemTemplate> </asp:TemplateColumn> It displays a blank. Also, I've got code where the user clicks an Edit link and it brings up the date and time part separately. When I try to run the following code: StartDate.Text = FormatDateTime(RS("StartDateTime"),2) StartTime.Text = FormatDateTime(RS("StartDateTime"),3) I get the error, "Cast from type 'MySqlDateTime' to type 'Date' is not valid.". I change change the above code to this: StartDate.Text = FormatDateTime(RS("StartDateTime").ToString,2) StartTime.Text = FormatDateTime(RS("StartDateTime").ToString,3) and it works... However, what can I do with the DataGrid column above? Thanks, Jesse -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]