J
J?rgen Stolz
Hi,
I have problems with a real device filling datetime column´s. If I
test the same with the emulator all works fine.
I create a table
string strSqlCreateTable = "CREATE TABLE T_LOG (" +
"C_LOG_DATE_TIME datetime NOT NULL," +
"C_LOG_INFO_CODE int," +
"C_LOG_INFO_MSG nvarchar(128)," +
"C_LOG_ERROR_CODE int," +
"C_LOG_ERROR_MSG nvarchar(128))";
and I insert data in the following way
DateTime logTime = DateTime.Now;
string insertSqlStatement = string.Format("INSERT INTO T_LOG
(C_LOG_DATE_TIME, C_LOG_INFO_CODE," + "C_LOG_INFO_MSG) " + "VALUES
('{0}',{1},'{2}')", logTime, 1, "Test");
With the real device an exception with the info "error in the datepart
format" is thrown.
If I use the following example
DateTime sendedFromMobile = DateTime.Now;
SqlDateTime sended = new SqlDateTime(sendedFromMobile);
string insertSqlStatement = string.Format("INSERT INTO T_LOG
(C_LOG_DATE_TIME, C_LOG_INFO_CODE," + "C_LOG_INFO_MSG) " + "VALUES
('{0}',{1},'{2}')", sended, 1, "Test");
the same error as above occours. Both examples works fine with the
emulator from the "Compact Framework"
Has anybody a hint for me?
Thanks in advance
Juergen
I have problems with a real device filling datetime column´s. If I
test the same with the emulator all works fine.
I create a table
string strSqlCreateTable = "CREATE TABLE T_LOG (" +
"C_LOG_DATE_TIME datetime NOT NULL," +
"C_LOG_INFO_CODE int," +
"C_LOG_INFO_MSG nvarchar(128)," +
"C_LOG_ERROR_CODE int," +
"C_LOG_ERROR_MSG nvarchar(128))";
and I insert data in the following way
DateTime logTime = DateTime.Now;
string insertSqlStatement = string.Format("INSERT INTO T_LOG
(C_LOG_DATE_TIME, C_LOG_INFO_CODE," + "C_LOG_INFO_MSG) " + "VALUES
('{0}',{1},'{2}')", logTime, 1, "Test");
With the real device an exception with the info "error in the datepart
format" is thrown.
If I use the following example
DateTime sendedFromMobile = DateTime.Now;
SqlDateTime sended = new SqlDateTime(sendedFromMobile);
string insertSqlStatement = string.Format("INSERT INTO T_LOG
(C_LOG_DATE_TIME, C_LOG_INFO_CODE," + "C_LOG_INFO_MSG) " + "VALUES
('{0}',{1},'{2}')", sended, 1, "Test");
the same error as above occours. Both examples works fine with the
emulator from the "Compact Framework"
Has anybody a hint for me?
Thanks in advance
Juergen