odbc连接数据库不能更新(recordset is read-only)解决方案

odbc连接数据库不能更新(recordset is read-only)
RT
代码如下:
void CChengView::OnButtonTj() 
{
// TODO: Add your control notification handler code here
cc dlg ;
if(dlg.DoModal()==IDOK)
{
int flag=0;
m_pSet->MoveFirst();
UpdateData(TRUE);
while(!m_pSet->IsEOF())
{
if(dlg.m_SNo==m_pSet->m_SNo)
{
flag=1;
MessageBox("该学生信息已存在","学生管理系统",0);
break;
}
m_pSet->MoveNext();
}
if(flag==0)
{
  m_pSet->AddNew();
m_pSet->m_SNo=dlg.m_SNo;
m_pSet->m_SN=dlg.m_SN;
m_pSet->m_Sex=dlg.m_Sex;
m_pSet->m_Age=dlg.m_Age;
m_pSet->m_Dept=dlg.m_Dept;
m_pSet->Update();//新纪录写入数据库的数据表
m_pSet->Requery();//刷新纪录
MessageBox("添加成功","学生管理系统",0);
}
}
}
添加数据时,出现recordset is read-only;

------解决方案--------------------
把数据库连接的代码贴出来吧

连接时用要用写的方式
------解决方案--------------------
肯定你Open的方法有问题,楼主上代码看看吧。