time more than 24
Posted by: chan saufui
Date: August 23, 2006 01:26AM

hi,
I have created a time column in mySQL using data type TIME and I have written a sample C# program to insert hour into the time colum but I have problem to insert time format which is more than 24 hours. When I tried to insert hours 30:00:00 into mySQL, I always get 06:00:00 shown in the time column.

The following are my sample C# code:

OdbcCommand insertCommand = new OdbcCommand();
insertCommand.Connection = odbcConnection;
insertCommand.CommandType = CommandType.Text;
insertCommand.CommandText = "INSERT INTO table (`Duration`) VALUES (?)";

OdbcParameter odbcInsertParameter1 = new OdbcParameter("Duration", OdbcType.Time, 0, "Duration");
odbcInsertParameter1.SourceVersion = DataRowVersion.Current;
odbcInsertParameter1.Direction = ParameterDirection.Input;

OdbcDataAdapter tempda = new OdbcDataAdapter();
tempda.InsertCommand = insertCommand;

DataTable tempdt = new DataTable();
DataRow tempdr = tempdt.NewRow();
tempdr["Duration"] = new TimeSpan( 30, 0, 0 );
tempdt.Add(tempdr);

tempda.Update(tempdt);

I'm using System.Data.TimeSpan to created the new hours and insert into mySQL. How do I insert time format which is more than 24 hours into mySQL ?


regards
george

Options: ReplyQuote


Subject
Written By
Posted
time more than 24
August 23, 2006 01:26AM
September 10, 2006 09:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.