今天往数据库插入记录,一直出错
strSQL.Format("INSERT INTO users(UserName,PassWord,DisplayName) VALUES ('%s','%s','%s')","东方不败","123456","东方妹妹");
m_pConnection->Execute((_bstr_t)strSQL,&RecordsAffected,adCmdText);
改成如下就对了
strSQL.Format("INSERT INTO users(UserName,LoginPassWord,DisplayName) VALUES ('%s','%s','%s')","东方不败","123456","东方妹妹");
m_pConnection->Execute((_bstr_t)strSQL,&RecordsAffected,adCmdText);
难道PassWord也是关键字吗,它只是被用作了字段名而已啊!