. NET execution of SQL insert time issues

Source: Internet
Author: User

Error Description:
A project, the source is the boss gave, deployed to the Internet, run no problem, but in the local run, there will be problems, the problem is to some tables inserted records, the local no matter how to insert, and the Internet can be inserted, are the same code

Solve:
Spent a night debugging, and finally figuring it out, such as:

The SQL statement executed by the local program is the same as above, the time format is wrong, so the insert fails, the entire transaction is rolled back, so there is no record in the table.
Because my system is WIN10, the date format default has the day of the week, in the source he used is DateTime.Now.ToString (), so the format will have a problem, changed to DateTime.Now.ToString ("Yyyy-mm-dd HH : Mm:ss ")

Conclusion:
Look at other people's source is really annoying ah. No comments yet ... In the future, I want to find the source code, I also have to delete the source code in the comments are only OK.

. NET execution of SQL insert time issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.