RecordsetPtr pRs;
pRs.CreateInstance(_uuidof(Recordset));//创建记录集对象
try
{
char a[800];
sprintf(a,"select 光强 from 光强数据表 where 月份 between 1 and 3 and 时间=%d",num_t);
pRs->Open(_bstr_t(a),m_pConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
/*var=pRs->GetCollect("光强");*/
data =pRs->GetRows(-1);
}
catch(_com_error e)
{
fout<<"获取数据错误!错误信息为:"<<e.ErrorMessage()<<endl;
fout.close();
return -1;
}
m_pConn->Close();
return(data);
delete [] data;
}
data是动态数组,现在有两个问题,一个是不能通过GetRows()将数据存入一维数组,一个是能不能用return返回数组,
做这个主要是用matlab调用这个exe,返回数组