想做一个通过主键检索出记录的其他的字段值的对话框,这个事件由一个按钮事件响应。
        CString strCaption=_T("");

if(m_bModify)
{   
CADORecordset adoRec;
CString strSql;
strSql.Format (IDS_QUERYCOURSETYPE);
//IDS_QUERYCOURSETYPE在stringtable 里定义"select typeid,typename,weight,description from coursetype where typeid="\n     这里有错吗 ?
UpdateData(true);
strSql+=m_strCourseID;//也就是typeid

SetWindowText(strCaption+" - 修改");
try
{
adoRec.Open(theApp.m_adoDB.m_pConnection,strSql);
if(!adoRec.IsEof())
{
adoRec.GetFieldValue("typename",m_strCourseTypeName);
adoRec.GetFieldValue("weight",m_nCourseTypeWeight);
adoRec.GetFieldValue("description",m_strDescription);
}
adoRec.Close();
}
catch (...)
{
}
}
else
{
SetWindowText(strCaption+" - 添加") ;
}
UpdateData(false);当对话框得到m_strCourseID时,调试的窗口strSql {""select typeid,typename,weight,description from coursetype where typeid="
1"}
这里有错吗 ?还报错找不到
"select typeid,typename,weight,description from coursetype where typeid="
存储过程。不知道哪里的问题。苦恼!2,如果把数据库连接语句adoRec.open(theApp.m_adoDB.m_pConnection,strSql);换为adoRec.open(m_padoDB->m_pConnection,strSql);
m_padoDB在头文件里声明了CADODatabase *m_pAdoDB里,为什么啊?