E2093'operator+' not implemented in type 'AnsiString' for arguments of the same type这个错误谁遇到过?
E2093 'operator+ ' not implemented in type 'AnsiString ' for arguments of the same type这个错误谁遇到过?
我在将数据存入数据库时遇到的错误。具体在sql语句里:
sql= "insert into user values( ' "; sql+=able_date+ " ', ' ",+name+ " ', ' "+name_code+ " ') ";
DM-> ADOQuery1-> Close();
DM-> ADOQuery1-> SQL-> Clear();
DM-> ADOQuery1-> SQL-> Add(sql);
DM-> ADOQuery1-> ExecSQL();
[解决办法]
AnsiString的operator+有问题
sql= "insert into user values( ' ";
sql=sql+able_date+ " ', ' "+name+ " ', ' "+name_code+ " ') ";
ShowMessage(sql);
[解决办法]
用sprintf格式化一下比较顺眼:
sql = String().sprintf(
"insert into user values( '%s ', '%s ', '%s ') ",
able_date, name, name_code);