[求助]无效游标错误
void CChukuDlg::OnOK() {
// TODO: Add extra validation here
CString materialname,count,data,jsr,lqr;
m_strMaterialname.GetWindowText(materialname);
m_strCount.GetWindowText(count);
m_strData.GetWindowText(data);
m_strJsr.GetWindowText(jsr);
m_strLqr.GetWindowText(lqr);
if(materialname.IsEmpty())
MessageBox("请输入物品名称");
else if(count.IsEmpty())
MessageBox("请输入数量");
else
{
CString strSQL,strSQL1;
strSQL.Format("select * from tblMaterialInfo where Materialname='%s'",materialname);
m_chukuset1.Open(CRecordset::forwardOnly,strSQL);
if(m_chukuset1.GetRecordCount()==0)
{
MessageBox("该物品不存在,请重新输入");
m_strMaterialname.SetWindowText("");
m_strMaterialname.SetFocus();
}
else
{
strSQL1.Format("Update btlMaterialInfo set Count=2 where Materialname='%s'",materialname);//我想将2赋给
//btlMaterialInfo数据表中Materialname=materialname的Count字段,但运行出现无效的游标。
m_chukuset1.Open();
m_chukuset1.m_strFilter=strSQL1;
m_chukuset1.Requery();
if(data.IsEmpty())
{
SYSTEMTIME sysTm;
::GetLocalTime(&sysTm);
m_chukuset.m_Data=sysTm;
}
m_chukuset.m_MaterialName=materialname;
m_chukuset.m_Count=atoi(count);
m_chukuset.m_Jsr=jsr;
m_chukuset.m_Lqr=lqr;
m_chukuset.Update();
m_chukuset.Close();
MessageBox("操作成功");
RefreshLish();
ResetButton();
}
}
}
运行后出错,说什么无效的游标,这是怎么回事啊,谁能帮我解决啊。课程设计,要交了,救救命啊
[此贴子已经被作者于2006-11-22 16:09:40编辑过]