
Masked Edit Control and Remote data control problem
I have a form with two controls: A Masked Edit control and a Remote data
control. There is also an
"OK" button on the form
I type in data into the Masked Edit control and then click OK (the
program goes to CBlueWhiteFormView::OnSlipOk() function). The data that
I had typed into the masked edit control is fed into the database. But
then I get a dialog box with the message:"No open cursor or cursor
closed". Why do I get this error message? How do I get rid of this error
message?. I am using an ODBC connection to the database.
void CBlueWhiteFormView::OnSlipsOk()
{
CMSMask* StudentIDBox = (CMSMask*) GetDlgItem(IDC_STUDENT_ID_BOX);
CRdc* SlipRDC = (CRdc*) GetDlgItem(IDC_SLIP_RDC);
ASSERT(StudentIDBox != NULL && SlipRDC != NULL);
if (StudentIDBox != NULL && SlipRDC != NULL)
{
SlipRDC->SetDataSourceName(_T("security"));
SlipRDC->SetCursorDriver(2);
StudentIDBox->BindDefaultProperty(0x16,VT_BSTR,_T("STUDENT_ID"),SlipRDC);
strStudentID = StudentIDBox->GetText();
strStudentID = _T("INSERT INTO SLIPTABLE (STUDENT_ID) VALUES ('") +
strStudentID + _T("')");
SlipRDC->SetSql(strStudentID);
SlipRDC->Refresh();
//StudentIDBox->Refresh();
}
Quote:
}