查询数据库代码

//打开数据库查询数据
CString sDatabase;
CString sQuery;
CStringList slResults;
CString sResult;
sDatabase.Format(_T("%sData\\%s"), GetAppRoot(), SDDATABASE);
COdbcDatabase db;
if (db.InitializeWithPath(sDatabase))
{
sQuery.Format(
_T("SELECT [PropertyName], [DefinitionId], [PropertyType], [DefaultVaule], [AlternativeValue], [OnlyAlternative] FROM ")
_T("%s ") _T("WHERE [ID] = 1"),
TABLE_CUSTOMPROPERTY);
slResults.RemoveAll();
db.GetQuery(sQuery, slResults);
}

posted @ 2015-09-02 14:29  xzh1993  阅读(498)  评论(0编辑  收藏  举报