I want to use the Oracle database to update data when I was building an ASP. NET Website. The fields in the table include int, string, and date.
I want to use the Oracle database to update data when I was building an ASP. NET Website. The fields in the table include int, string, and date.
I want to use the Oracle database to update data when I was building an ASP. NET Website. The fields in the table include int, string, and date. NET front-end controls always encounter problems when bound to updates. I checked a lot of things online and always looked at the ambiguity. After all, it was the first time I came into contact with Oracle. I updated my initial post (now this problem has been solved). Let's take a look:
The update statement is as follows: SQL =. txtname. text. trim (), this.txt ip. text. trim (), this.txt port. text. trim (), this.txt time. text. trim (), this.txt location. text. trim (), this.txt installtime. text. trim (), this. dropDownList_tname.Text.Trim (), this.txt id. text. trim ());
First, the problem is the "type" and "single quotation marks". The error is reported, for example:
This error is, ORA-01861: the text does not match the format string.
It may be because the time column in your table has the data type of date.
After you pass in a character format, the database does not know how to format the character information as a date.
The following is an example and solution of error reproduction provided by a netizen. Thank you very much for your help.
SQL> create table test_time (time date); the table has been created. SQL> insert into test_time values (); insert into test_time values () * ERROR in row 1st: ORA-01861: text does not match Format String SQL> insert into test_time values (); insert into test_time values () * ERROR is located at row 1st: ORA-01861: text does not match the format string SQL> insert into test_time values (TO_DATE (,); 1 row has been created.
The above update statement is summarized as follows:
The string type can be enclosed in single quotes, such as r. name = '{0}', r. ip = '{1}', r. port = '{2}' and so on;
The int type cannot be enclosed in single quotes in the Oracle database update statement. id = '{7}' is not acceptable. You should remove the single quotation mark and change it to id = {7 };
The date type can be enclosed in single quotes, but it is not like r. for time = '{3}', TO_DATE () should be applied to convert the format, such as: r. time = to_date ('{3}', 'yyyy-mm-dd '). In the asp.net foreground control, data of the string type is input. During update, the data must be converted to the Time Type format. The updated statement is as follows:
SQL =,), this. DropDownList_tname.Text.Trim (), this.txt id. Text. Trim ());
Finally, if you still need other answers in the TO_DATE format in Oracle, the following link address will be detailed and I believe it will help you.