标题:求大神,怎样把II JJ KK 传入到sql语句中呢???
只看楼主
weichaoheng
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-6-14
结帖率:0
已结贴  问题点数:20 回复次数:1 
求大神,怎样把II JJ KK 传入到sql语句中呢???
void CEx2View::OnButton2()
{
    // TODO: Add your control notification handler code here
    UpdateData(true);
    int II=2;  int JJ=2;  int KK=2;
    long m_1,m_2,m_3,m_00=0;

    CString str;               
    //str.Format("select * from frp3 where k='%s' ",K);
    //str.Format("select * from frp3 where i=2 and j=2 and k=2");
    str.Format("select * from frp3 where i='%d' and j='%d' and k='%d' ",II,JJ,KK);
               
                try
                {            
                    _variant_t RecordsAffected;
                    m_pRecordset =m_pConnection->Execute((_bstr_t)str,&RecordsAffected,adCmdText);
                    
                    _variant_t vCount;
                    
                    vCount = m_pRecordset->GetCollect("Cijkf");
                    m_1=vCount.lVal;
                    
                    vCount = m_pRecordset->GetCollect("Cijkrp");
                    m_2=vCount.lVal;   
                    
                    vCount = m_pRecordset->GetCollect("Cijkcl");
                    m_3=vCount.lVal;
                    
                    m_00=m_1+m_2+m_3;
                }
                catch(_com_error*e)
                {
                    AfxMessageBox(e->ErrorMessage());
                }

                m_0=m_00;   
                UpdateData(false);
}
搜索更多相关主题的帖子: sql语句 control where 
2013-06-14 17:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-415179-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.252663 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved