这是一个数据保存到表里的代码
void CSendDIN::Onsave()
{
// TODO: Add your control notification handler code here
CString grade;
grade.Format("%d",m_ggrade);
UpdateData(true);
if ( (AfxMessageBox("是否要保存数据 " , MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2)) == IDYES )
{
if(m_gid.IsEmpty())
{
AfxMessageBox("请输入学生学号!");
return;
}
else if(m_gsubject.IsEmpty())
{
AfxMessageBox("请输入课程名!");
return;
}
else if(grade.IsEmpty())
{
AfxMessageBox("请输入成绩!");
return;
}
pSet->AddNew();
pSet->m_ID=m_gid;
pSet->m_name=m_gname;
pSet->m_subject=m_gsubject;
pSet->m_grade=m_ggrade;
pSet->Update();
pSet->Requery();
AfxMessageBox("数据已经正确保存!");
}
}
前面我已经定义了CSendDIN* pSet;(CSendDIN的基类为CRecordSet)
但编译是出现一大堆错误:
'CSendSet' : missing storage-class or type specifiers
'pSet' : missing storage-class or type specifiers
'pSet' : undeclared identifier
left of '->m_ID' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->m_name' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->m_subject' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->Update' must point to class/struct/union
left of '->AddNew' must point to class/struct/union
left of '->m_ID' must point to class/struct/union
left of '->m_name' must point to class/struct/union
left of '->m_subject' must point to class/struct/union
left of '->m_grade' must point to class/struct/union
left of '->Update' must point to class/struct/union
left of '->Requery' must point to class/struct/union
void CSendDIN::Onsave()
{
// TODO: Add your control notification handler code here
CString grade;
grade.Format("%d",m_ggrade);
UpdateData(true);
if ( (AfxMessageBox("是否要保存数据 " , MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2)) == IDYES )
{
if(m_gid.IsEmpty())
{
AfxMessageBox("请输入学生学号!");
return;
}
else if(m_gsubject.IsEmpty())
{
AfxMessageBox("请输入课程名!");
return;
}
else if(grade.IsEmpty())
{
AfxMessageBox("请输入成绩!");
return;
}
pSet->AddNew();
pSet->m_ID=m_gid;
pSet->m_name=m_gname;
pSet->m_subject=m_gsubject;
pSet->m_grade=m_ggrade;
pSet->Update();
pSet->Requery();
AfxMessageBox("数据已经正确保存!");
}
}
前面我已经定义了CSendDIN* pSet;(CSendDIN的基类为CRecordSet)
但编译是出现一大堆错误:
'CSendSet' : missing storage-class or type specifiers
'pSet' : missing storage-class or type specifiers
'pSet' : undeclared identifier
left of '->m_ID' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->m_name' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->m_subject' must point to class/struct/union
left of '.IsEmpty' must have class/struct/union type
left of '->Update' must point to class/struct/union
left of '->AddNew' must point to class/struct/union
left of '->m_ID' must point to class/struct/union
left of '->m_name' must point to class/struct/union
left of '->m_subject' must point to class/struct/union
left of '->m_grade' must point to class/struct/union
left of '->Update' must point to class/struct/union
left of '->Requery' must point to class/struct/union
解决方案 »
- 对话框有多个ListBox只允许用户选择任何一个ListBox中的一项
- 为什么程序中定义CInternetSession时会出错
- ***********我有一个类CPerson,如何让它从CObject继承?在New Class对话框的下拉列表里没有CObject类啊*******
- ** 请教 DLL 中返回数组,并在Excel VB中调用的问题 ???
- 关于(CSplitterWnd)窗口嵌套拆分的一个问题!
- ★★★★★★知道一个HMENU怎么样取得CMenu*的指针?没分了!
- 大家说说是不是骗子
- 初学者!请各位老哥帮忙!谢谢!在线等待!
- 100分求助----bstrcmp,bstrlen是在哪个头文件里定义的啊?
- 怎样在VC下更改网卡MAC地址,以让Windows认更改后的网卡MAC地址
- 怎样让程序在后台进行不被看到
- 关于飞客户区重画的问题,请高手指教
我是在SendDIN.h中定义CSendSet* pSet的
是public