16,472
社区成员
发帖
与我相关
我的任务
分享
void CPage2::OnTj()
{
CString strTemp,m_bt;
GetDlgItem(IDC_EDIT1)->GetWindowText(m_bt);
GetDlgItem(IDC_COMBO1)->GetWindowText(strTemp);
str1.Format("insert into wz(title,class)values('%s','%s')", m_bt,strTemp);
try
{
(CMy8App*)AfxGetApp()->m_pConnection->Execute((_bstr_t)str1,NULL,adCmdText);
}
catch(_com_error *e)
{
return;
}
void CMyView::OnBrowse()
{
。。。
if(SUCCEEDED((CMy8App*)AfxGetApp()->m_pConnection.CreateInstance(__uuidof(Connection) )))
{
(CMy8App*)AfxGetApp()->m_pConnection->CursorLocation=adUseClient; //游标类型
}
try
{
(CMy8App*)AfxGetApp()->m_pConnection->Open(。。。,"","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败,确认数据库是否在当前路径下!");
}
}