请高手指点error C2039: 'GetYear' : is not a member of 'CDateTimeCtrl' MFC ado access 插入 时间类型 5
代码:voidCAdd::OnOK(){//TODO:AddextravalidationhereUpdateData(true);CStringsql,strTime,...
代码:
void CAdd::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString sql,strTime,strTemp,temp;
strTemp.Format("%d",m_date.GetYear());
strTime=strTemp;
strTemp.Format("%d",m_date.GetMonth());
strTime=strTime+"-"+strTemp;
strTemp.Format("%d",m_date.GetDay());
strTime=strTime+"-"+strTemp;
GetDlgItemText(IDOK,temp);
if(temp=="添加")
{
// CTime now=CTime::GetCurrentTime();
// nowtime=now.Format(_T("%年%月%日时%分%秒"));
CString sql;
sql.Format(_T("insert into payment values('%s','%s',%f,'%s','%s')"),m_name,strTime,m_money,m_cobReason,m_beizhu);
_variant_t RecordsAffected;
theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
AfxMessageBox("成功插入一条数据")
//shuaxin List列表
CM1316App *pApp=(CM1316App *)AfxGetApp();
CM1316Dlg *pDlg=(CM1316Dlg *)pApp->m_pMainWnd;
sql="SELECT * FROM payment where name='"+theApp.name+"'";
pDlg->ReadtoList(sql);
m_date=strTime;
m_money=0.0;
m_cobReason="";
m_beizhu="";
UpdateData(false);
}
return;
} 展开
void CAdd::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString sql,strTime,strTemp,temp;
strTemp.Format("%d",m_date.GetYear());
strTime=strTemp;
strTemp.Format("%d",m_date.GetMonth());
strTime=strTime+"-"+strTemp;
strTemp.Format("%d",m_date.GetDay());
strTime=strTime+"-"+strTemp;
GetDlgItemText(IDOK,temp);
if(temp=="添加")
{
// CTime now=CTime::GetCurrentTime();
// nowtime=now.Format(_T("%年%月%日时%分%秒"));
CString sql;
sql.Format(_T("insert into payment values('%s','%s',%f,'%s','%s')"),m_name,strTime,m_money,m_cobReason,m_beizhu);
_variant_t RecordsAffected;
theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
AfxMessageBox("成功插入一条数据")
//shuaxin List列表
CM1316App *pApp=(CM1316App *)AfxGetApp();
CM1316Dlg *pDlg=(CM1316Dlg *)pApp->m_pMainWnd;
sql="SELECT * FROM payment where name='"+theApp.name+"'";
pDlg->ReadtoList(sql);
m_date=strTime;
m_money=0.0;
m_cobReason="";
m_beizhu="";
UpdateData(false);
}
return;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询