vc 6.0 读取oracle 数据 代码如下
从记事本中读出文件:加入到数据库,文本文件只有一个字段。
pRst->Open("SELECT * FROM ztemptablemyw",
pConn.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
CString str;
str="";
do{
out.ReadString(str);
pRst->AddNew();
pRst->PutCollect("YHM",(_variant_t)str);
pRst->Update();
}while (out.GetPosition()!=out.GetLength());
都小一点数据量的都没有问题,但是如果读的 太多就出问题了,程序直接卡死了 是什么问题啊?
从记事本中读出文件:加入到数据库,文本文件只有一个字段。
pRst->Open("SELECT * FROM ztemptablemyw",
pConn.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
CString str;
str="";
do{
out.ReadString(str);
pRst->AddNew();
pRst->PutCollect("YHM",(_variant_t)str);
pRst->Update();
}while (out.GetPosition()!=out.GetLength());
都小一点数据量的都没有问题,但是如果读的 太多就出问题了,程序直接卡死了 是什么问题啊?
是什么原因,有没有办法解决。
---------------------------------------------
FALSE if end-of-file was reached without reading any data.while(out.ReadString(str))
{
pRst->AddNew();
pRst->PutCollect("YHM",(_variant_t)str);
pRst->Update();
}
加一个try,看看报什么错
主要读不出来数据是因为这样太慢了,读50000个数据时间要好几分钟
vier_ch 方法也可以读数据的CStdioFile out;
out.Open(m_StrFileName, CFile::modeRead);
out.ReadString(str);
out.Close();为什么单步调试的时候到Out.Close()会出现错误
而运行的时候不会出现错误。出现的错误信息是debug assertion fail 出现终止,重试,调试的对话框
·使用ado绑定试试看
·使用ado的安全数组不知道能否提高效率……不过最重要的还是……开启一个事务,每导入1000-2000记录,将事务提交一次……