Found today
Microsoft ole db provider for SQL Server (0x80040e07)
A syntax error occurs when converting a string to datetime.
. Check the program and find that the current time obtained in the program uses now () and response. the write output indicates that "Morning" or "Afternoon" appears in the string, while the datetime (8) Type of the SQL Server database does not accept "Morning" or "Afternoon ", it cannot be automatically converted, so an error occurs. (If you try again, this will not happen in the ACCESS database ).
For example, insert into test (time) values ('2017-04-03 3:50:12 ') is automatically converted to the 24-hour format in access. The value is "2010 15:50:12 ". However, an error occurs in SQL Server, prompting "A syntax error occurred when converting a string to datetime. "This should be the problem of time format settings. Check the Internet and solve the problem through the following methods.
I. Windows XP solution (modify the registry, I have tested it successfully)
1. Control Panel-region and language options-set the time to the 24-hour format.
2. Create HKEY_LOCAL_MACHINE/software/Microsoft/oleaut/varconversionlocalesetting = 2 (DWORD)
Note: The oleaut item may not exist. If it does not exist, you must first create this item.
3. Restart IIS.
Solve the problem.
The principle is to force ASP time to use the region format.
Ii. Solution for Windows 2003 (modify region settings)
On the Control Panel → area settings → time style and date format settings:
Set the time style to HH: mm: Ss.
Set the short date format to yyyy-mm-dd.
(Win2003 does not need to modify the Registry. Someone has successfully tested it)
Iii. General Solutions (modified in the Program)
Replace can be used to replace the "Morning" or other unwanted characters...
For example, <% = Replace (now, "Morning", "") %>
Or replace all Chinese characters: Replace (now, "[/u4e00-/u9fa5]", "").