1

Here's my code:

    uprs.moveToInsertRow();
uprs.updateString("Sender", myName);
uprs.updateString("Receiver", withWho);
uprs.updateString("Message", myMessage);
//uprs.updateString("Time",****);
uprs.insertRow();

Things go perfectly when adding the non-time data into the database.

But I am struggling how to add the current date and time into the database.(Ms SQL 2008)

Is there any expert can tell me how to organize the code about getting the current time and date and insert them into the db?

The data type of Time in my db is "datetime".

Thank you!

0

1 Answer 1

1

For a date/time type you should use updateTimestamp instead of updateString

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.