回 帖 发 新 帖 刷新版面

主题:[原创]有高手吗?VC++无法获得 【最大日期编号】 请各位高手帮忙解决,谢谢!

有高手吗?VC++无法获得 【最大日期编号】 请各位高手帮忙解决,谢谢!
long CDLgMain::GetRecordCount(CString sql)
{
    long lcount;

    try
    { 
        m_pRs->raw_Close();

    }

    catch(_com_error e)//
    {
        CString stemp;
        stemp.Format("无法获得记录总数:%s",e.ErrorMessage());
        AfxMessageBox(stemp);
    }
    return lcount;
}

CString CDLgMain::GetNewBillID()
{
    CString sql,snowtime;
    CString sNewID,scurid,snewid;
    long lnewid,lcount;

    CTime now=CTime::GetCurrentTime();
    snowtime=now.Format(_T("%Y%m%d"));//现在:年月日


    if(lcount==0)
    {
        sNewID.Format("%s-00001",snowtime);
        return sNewID;
    }




  
    try    
    { 
        //m_pRs.CreateInstance("ADODB.Recordset");
        m_pRs->raw_Close();

    }
    catch(_com_error e)
    {
        CString stemp;
        stemp.Format("无法获得最大编号!",e.ErrorMessage());
        AfxMessageBox(stemp);
    }
    return sNewID;
}



说明:不检索数据库,程序直接跳过本段,默认数据库为空,直接执行以下程序进行赋值:
    if(lcount==0)
    {
        sNewID.Format("%s-00001",snowtime);
        return sNewID;
    }
望高手解决,谢谢!本人邮箱:dymajinglei@163.com

回复列表 (共1个回复)

沙发

自己解决吧!

我来回复

您尚未登录,请登录后再回复。点此登录或注册