本文整理汇总了C++中CRecordset::IsOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ CRecordset::IsOpen方法的具体用法?C++ CRecordset::IsOpen怎么用?C++ CRecordset::IsOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRecordset
的用法示例。
在下文中一共展示了CRecordset::IsOpen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUpdateRecordNext
void CRecordView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
CRecordset* prs = OnGetRecordset();
// enable if opened and >= 1 records present
pCmdUI->Enable(prs->IsOpen() && !(prs->IsEOF() && prs->IsBOF())
// and not already on last record
&& !IsOnLastRecord());
}
示例2: OnUpdateRecordLast
void CRecordView::OnUpdateRecordLast(CCmdUI* pCmdUI)
{
CRecordset* prs = OnGetRecordset();
// enable if opened, can scroll,
pCmdUI->Enable(prs->IsOpen() && prs->CanScroll() &&
// >= 1 records present and not already on last record
!(prs->IsEOF() && prs->IsBOF()) && !IsOnLastRecord());
}
示例3: OnInitialUpdate
void CRecordView::OnInitialUpdate()
{
CRecordset* pRecordset = OnGetRecordset();
// recordset must be allocated already
ASSERT(pRecordset != NULL);
if (!pRecordset->IsOpen())
{
CWaitCursor wait;
pRecordset->Open();
}
CFormView::OnInitialUpdate();
}
示例4: GetStaticData
void CEdRptDoc::GetStaticData(CRecordset &rc)
{
if (!rc.IsOpen())
return;
CString csTmp;
GV_ITEM Item;
Item.mask = GVIF_TEXT|GVIF_FORMAT;
Item.nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX;
Item.row = m_Grid.GetRowCount() - 1;
Item.col = 0;
Item.szText = "总计";
m_Grid.SetItem(&Item);
CString csFormat;
CODBCFieldInfo fi;
for (Item.col = 1; Item.col < m_ColFmt.GetSize(); Item.col++)
{
if (m_ColFmt[Item.col].format.IsEmpty())
{
rc.GetODBCFieldInfo(short(Item.col), fi);
if (fi.m_nSQLType == SQL_NUMERIC || fi.m_nSQLType == SQL_DECIMAL)
{
if (fi.m_nScale == 0)
{
fi.m_nSQLType = SQL_INTEGER;
csFormat.Format("%%%dd", fi.m_nPrecision);
}
else
{
fi.m_nSQLType = SQL_FLOAT;
csFormat.Format("%%%d.%df", fi.m_nPrecision, fi.m_nScale);
}
}
}
else
{
csFormat = m_ColFmt[Item.col].format;
if (csFormat.FindOneOf("dioux") > 0)
fi.m_nSQLType = SQL_INTEGER;
else if (csFormat.FindOneOf("eEfgG") > 0)
fi.m_nSQLType = SQL_FLOAT;
else
fi.m_nSQLType = SQL_DATETIME;
}
switch(fi.m_nSQLType)
{
case SQL_INTEGER:
case SQL_SMALLINT:
case SQL_TINYINT:
case SQL_BIGINT:
fi.m_nSQLType = SQL_INTEGER;
if (csFormat.IsEmpty())
csFormat = _T("%d");
break;
case SQL_FLOAT:
case SQL_REAL:
case SQL_DOUBLE:
fi.m_nSQLType = SQL_FLOAT;
if (csFormat.IsEmpty())
csFormat = _T("%f");
break;
default:
break;
}
double fSum = 0.0;
if (fi.m_nSQLType == SQL_INTEGER || fi.m_nSQLType == SQL_FLOAT)
{
CString csTmp;
for (int j = 1; j < m_Grid.GetRowCount() - 1; j++)
{
csTmp = m_Grid.GetItemText(j, Item.col);
fSum += atof(csTmp);
}
}
if (fi.m_nSQLType == SQL_INTEGER)
Item.szText.Format(csFormat, (int)fSum);
else if (fi.m_nSQLType == SQL_FLOAT)
Item.szText.Format(csFormat, fSum);
else
Item.szText = "--:--";
Item.szText.TrimLeft();
Item.szText.TrimRight();
m_Grid.SetItem(&Item);
}
}