Android Question RDC Connector - Insert a datetime field value

Sytek

Active Member
Licensed User
Longtime User
Hello Erel!
When I Insert a datetime field value
PHP:
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "insert_serial"
cmd.Parameters = ArrayAsObject(md5imei,ima.Input,"adddate(current_timestamp,30)","current_timestamp","current_timestamp")
reqManager.ExecuteCommand(cmd, "tag")
...The RDC throws me this error.
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '
current_timestamp' for column 'endaccess' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4094)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2734)


I can insert in the phpmyadmin sql command without problem.
PHP:
insert into serials(serial,name,endaccess,lastaccess,firstaccess) values ('111111','serial name',adddate(current_timestamp,30),current_timestamp,current_timestamp)

I'm I Missing Something?

Thank's in advance for your help
Best Regards!
 
Last edited:

Sytek

Active Member
Licensed User
Longtime User
Hello Erel!
When I Insert a datetime field value
PHP:
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "insert_serial"
cmd.Parameters = ArrayAsObject(md5imei,ima.Input,"adddate(current_timestamp,30)","current_timestamp","current_timestamp")
reqManager.ExecuteCommand(cmd, "tag")
...The RDC throws me this error.
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '
current_timestamp' for column 'endaccess' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4094)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2734)


I can insert in the phpmyadmin sql command without problem.
PHP:
insert into serials(serial,name,endaccess,lastaccess,firstaccess) values ('111111','serial name',adddate(current_timestamp,30),current_timestamp,current_timestamp)

I'm I Missing Something?

Thank's in advance for your help
Best Regards!
EDIT:
Hello Erel!
I had to remove the Date Functions in the b4a App and added into the server side config file properties
PHP:
sql.insert_serial=insert into serials(serial,name,endaccess,firstaccess,lastaccess) values (?,?,DATE_ADD(NOW(),INTERVAL 30 DAY),NOW(),NOW())
...and this Works just fine.
 
Upvote 0

Bladimir Carrillo

Member
Licensed User
Longtime User
Hello,
How I can insert a datetime value that is not current date time ?

My app feature let me save a date time on device internal sqlite database and after sync when I have wifi signal, but the date time value to send to RDC server most be the saved on site (not current date time).

I'll appreciate your valuable assistance.

Thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is an old thread. Please start a new thread for your question.
 
Upvote 0
Top