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 binding 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:
= .Format(
.txtname.Text.Trim(), .txtip.Text.Trim(), .txtport.Text.Trim(), .txttime.Text.Trim(), .txtlocation.Text.Trim(), .txtinstalltime.Text.Trim(), .DropDownList_tname.Text.Trim(), .txtid.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. Here I am very grateful for his enthusiastic help (the link is http://zhidao.baidu.com/question/551220541? Quesup2 & oldq = 1)
SQL> insert into test_time values (*-> insert into test_time values (TO_DATE (, row.
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 = .Format(m-dd'),r.type=(select d.id from xxt_devicetype d where d.name='{5}') where r.id={6}.txtname.Text.Trim(), .txtip.Text.Trim(), .txtport.Text.Trim(), .txtlocation.Text.Trim(), .Calendarinstalltime.SelectedDate.ToString(), .DropDownList_tname.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.
Http://www.cnblogs.com/ajian/archive/2009/03/25/1421063.html