vc SQL insert语句
程序的代码如下:
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
//_CommandPtr pCmd(__uuidof(Command));
pConn->ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Patent;Data Source=ABCDEFG;";
pConn->Open("","","",adConnectUnspecified);
这里给seq,str1,str2,str3,str4,str5,str6赋值
_bstr_t seq=xml.GetChildData();
_bstr_t str1=xml.GetChildData();
.
.
.
.
最后执行下面的语句时就终止
pConn->Execute("INSERT PatentData (pa_seq,pa_type,pa_name,pa_number,pa_id,pa_date,pa_abstract) VALUES ("+seq+","+str1+","+str2+","+str3+","+str4+","+str5+","+str6+")",NULL,adCmdText);
编译能通过,就是不能实现。
[解决办法]
直接打印SQL,然后看数据库中能否执行成功,估计SQL语句有问题
[解决办法]
调试看看sql 串是什么
应该是字段类型不匹配
[解决办法]
是insert into吧,少写了into