|
_ConnectionPtr m_pConnection;
_variant_t rows;
char buff[5];
CString sql = "alter table AAA add P1 char";
try
{
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open("rovider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\db1.mdb","","",adModeUnknown);
for(int loop=0; loop<10;loop++)
{
_itoa(loop, buff, 10);
sql = "alter table AAA add ";
sql += "";
sql += buff;
sql += " char";
m_pConnection->Execute((_bstr_t)sql, &rows, adCmdText);
}
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
return;
}
在完成P6这个字段的添加后就产生异常了,不能继续P7-P9的添加。试了好几次,全这样。
|
|