刚好用到ADO数据库一下,就从别的地方弄来的代码,那个执行一句查询语句是没问题,现在我要执行好几句语句,如下declare @id int 
select @id=(max(lan_id)+1) from LanUser
insert LanUser values( @id, '000000', ' ', ' ', 0, ' ', ' ', 0 )");
代码如下:
CoInitialize(NULL);
CString result="";    //用于保存查询结果
TCHAR cstr[500];   
memset( cstr, 0, 100 );
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
_CommandPtr pCmd(__uuidof(Command));pConn->ConnectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=LanMessager;Data Source=.";
pConn->Open( "", "", "", adConnectUnspecified);
pCmd->put_ActiveConnection(_variant_t((IDispatch*)pConn));strcpy(cstr,"declare @id int select @id=(max(lan_id)+1) from LanUser insert LanUser values( @id, '000000', ' ', ' ', 0, ' ', ' ', 0 )");pCmd->CommandText=cstr;
pRst=pCmd->Execute(NULL,NULL,adCmdText);  //出错了 pRst->Close();
pConn->Close();
pCmd.Release();
pRst.Release();
pConn.Release();
CoUninitialize();
我是像一句SELECT语句一样操作的,不知道正确的该如何执行?