
具体的函数实现,如果需要我再贴上来。
void CMCTTView::ListItem()//刷新列表
{
int i = 0
if(!m_pSet->IsOpen())
AfxMessageBox("数据源未打开")
m_Item.SetExtendedStyle(m_Item.GetExtendedStyle()|LVS_EX_FULLROWSELECT)
m_Item.DeleteAllItems()
m_Item.SetRedraw(FALSE)
if (!m_pSet->GetRecordCount() == 0)
{
m_pSet->MoveFirst()
}
while(!m_pSet->IsEOF())
{
m_Item.InsertItem(i,"")
m_Item.SetItemText(i,0,m_pSet->m_column1)
m_Item.SetItemText(i,1,m_pSet->m_column2)
m_Item.SetItemText(i,2,m_pSet->m_column3)
m_Item.SetItemText(i,3,m_pSet->m_column4)
i+=1
m_pSet->MoveNext()
}
m_Item.SetRedraw(TRUE)
}
void CMCTTView::OnItemDel() //在view类中删除条目
{
// TODO: Add your control notification handler code here
int listIndex //当前选中项的索引
//首先得到点击的位置
POSITION pos=m_Item.GetFirstSelectedItemPosition()//0 basedm_item是指代列表控件
if(pos==NULL)
return
//得索引,通过POSITION转化
listIndex=m_Item.GetNextSelectedItem(pos)+1//1 based,so 1 added
m_pSet->SetAbsolutePosition(listIndex)
if ( MessageBox( _T( "你确定要删除当前单词信息吗?" ),
_T( "删除确认?" ), MB_OKCANCEL | MB_ICONQUESTION ) == IDOK )
{
m_pSet->Delete()
MessageBox( _T( "该单词信息已经被成功删除!" ),
_T( "删除成功!" ), MB_OK | MB_ICONASTERISK )
OnNext()
}
m_pSet->Requery()
//if(!m_pSet->GetRecordCount() == 0)
ListItem()
}
void CMCTTView::OnNext()
{
m_pSet->MoveNext()
if ( m_pSet->IsEOF() )
m_pSet->MoveFirst()
}
int CMCTTDoc::AddToAcc()//在doc类中添加数据
{
m_mCTTSet.AddNew()
CString str1,str2,str3,str4
str1.Format("%s",m_Index)
str2.Format("%f",m_UseHs)
str3.Format("%f",m_UseHj)
switch (m_HJStyle)
{
case 0:
str4 = CString("类型1")
break
case 1:
str4 = CString("类型2")
break
case 2:
str4 = CString("类型3")
break
}
m_mCTTSet.m_column1 = str1 //Index
m_mCTTSet.m_column2 = str2//the use of hansi
m_mCTTSet.m_column3 = str3//the use of hanji
m_mCTTSet.m_column4 = str4//the style of hanjie
m_mCTTSet.Update()
m_mCTTSet.Requery()
MessageBeep(MB_OK)
CMainFrame* pframe = (CMainFrame*)AfxGetMainWnd()
CMCTTView* pInterfaceView = (CMCTTView*)pframe->GetActiveView()
pInterfaceView->ListItem()
return 0
}
你的标准参数表在哪儿?如果你的标准参数在数据库中的话
你就要定义一个CDataBase类的对象,然后用他来打开数据库。然后定义一个CRecordSet类的对象,用它来进行对数据库的select查询(这个查询的结果最后会返回至对象中)。然后你在把这个对象里的内容和对话框中每个文本框内的数据进行比较就可以了啊。
具体可能比较复杂,但是思路还是比较简单的,如果有不会的 可以继续追问
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)