插入一个字符串变量到数据库报MISSING OPERATOR OR semicolon错误,请朋友进来指教下具体写法
最好再给我解释下DEIPHI的单引号在SQL字符串中怎样用的谢谢
sql1:='INSERT INTO tbl_SMSendTask';sql2:=' (CreatorID,SmSendedNum,OperationType,SendType,OrgAddr,DestAddr,SM_Content,SendTime,NeedStateReport,ServiceID,FeeType,FeeCode,SMType,MessageID,DestAddrType,SubTime,TaskStatus,SendLevel,SendState,TryTimes)';sql3:=' VALUES('TEST', 0, 'was',1, 'null', '15818548017','''+rstr+''', getdate(),0, 'MGD0019901', '01', '000000',0,'',0, getdate(),0,0,0,3)';sql:=sql1+sql2+sql3;//ADOQuery2.SQL.Text:='insert into message(message) values('''+rstr+''')';ADOQuery2.SQL.Text:=sql;AdoQuery2.ExecSQL;
sql3:=' VALUES(''TEST'', 0, ''was'',1, ''null'', ''15818548017'','''+rstr+''', getdate(),0, ''MGD0019901'', ''01'', ''000000'',0,'''',0, getdate(),0,0,0,3)';
[解决办法]
sql3:=' values('''+'test'''+',0,'''+'was'''+',1,'+'null'+','''+'158988349'''+','''+rstr+''''+',getdate(),0,'''+''MGD0019901'''+','''+'01'''+','''+'000000'''+',0,getdate(),0,0,0,3)';