Friday, December 4, 2009

Database Connection Using DAO in VC++

File Name :: DAOConnView.cpp

Coding ::

void CDAOConnView::OnMoveFirst()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveFirst();

UpdateData(FALSE);

}

void CDAOConnView::OnMovePrev()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MovePrev();

if(m_pSet->IsBOF() == TRUE)

{

MessageBox("First Record","Alert");

m_pSet->MoveFirst();

}

UpdateData(FALSE);

}

void CDAOConnView::OnMoveNext()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveNext();

if(m_pSet->IsEOF() == TRUE)

{

MessageBox("Last Record","Alert" );

m_pSet->MoveLast();

}

UpdateData(FALSE);

}

void CDAOConnView::OnMoveLast()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->MoveLast();

UpdateData(FALSE);

}

void CDAOConnView::OnAdd()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->AddNew();

UpdateData(FALSE);

}

void CDAOConnView::OnSave()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->Update();

UpdateData(FALSE);

}

void CDAOConnView::OnUpdate()

{

// TODO: Add your control notification handler code here

m_pSet->Edit();

}

void CDAOConnView::OnDelete()

{

// TODO: Add your control notification handler code here

UpdateData();

m_pSet->Delete();

m_pSet->Requery();

m_pSet->MoveNext();

UpdateData(FALSE);

}

No comments:

Post a Comment