有以下几个参量(CString s0,CString s1, CString s2, CString s3, CString s4, CString s5, CString s6........)要传输到数据库ACCESS中,请高手给个例子!要事半功倍一些!!说明以下是用的ODBC,还是ADO....

解决方案 »

  1.   

    用ado吧,http://www.vckbase.com/document/viewdoc/?id=1215
      

  2.   

    参考:http://www.programbbs.com/doc/297.htm
    http://www.czxiaofeng.com/bbs/ShowPost.asp?id=474
      

  3.   

    可以使用DBgrid和remoteData control控件
      

  4.   

    http://www.vckbase.com/document/viewdoc/?id=496
      

  5.   

    利用ADO:
    1、在StdAfx.h中#import "C:\Program Files\Common Files\System\ADO\msado15.dll"\
    no_namespace rename("EOF", "adoEOF")
    2、在MainFrm.h中
    _ConnectionPtr pMyConnect;//创建ADO连接的连接接口
    _RecordsetPtr pRecordset;
    3、在MainFrm oncreate中:
    AfxEnableControlContainer();
    AfxOleInit();//初使化COM
    HRESULT hr=pMyConnect.CreateInstance("ADODB.Connection");
    if(FAILED(hr))
    return false;
    _bstr_t strConnect="Provider=Microsoft.Jet.OLEDB.4.0;\Data Source=.\\DataBase\\BKMAN.mdb";
    //"Provider=SQLOLEDB;Server=TAO;Database=Forum;uid=sa;pwd=;";
    try
    {
    pMyConnect->Open(strConnect,"","",adModeUnknown);//打开数据库的
    pRecordset.CreateInstance("ADODB.Recordset");
    }
    catch(_com_error &e)
    {
    ::MessageBox(NULL,e.Description(),"警告",MB_OK|MB_ICONWARNING);
    }
    4、用到的页面
    extern  _ConnectionPtr pMyConnect;//创建ADO连接的连接接口
    extern _RecordsetPtr pRecordset;下面写数据进库:
    CString Sqlstr;
    Sqlstr.Format(_T("Select * from BK_CHANKILL where Kill_Status=0"));
    pRecordset->Open(_variant_t(Sqlstr),_variant_t((IDispatch *)pMyConnect,true),adOpenStatic,adLockOptimistic,adCmdText);
    if(!pRecordset->adoEOF)
    pRecordset->MoveFirst(); CTime time;
    time = CTime::GetCurrentTime();// Get the current system time
    CString str_Time;                        
    str_Time= time.Format("%Y-%m-%d");// convert the time to the string format pRecordset->PutCollect(_variant_t((long)3),_variant_t((long)1));//把1写进该行第4列,下标0开始
    pRecordset->PutCollect(_variant_t((long)7),_variant_t(str_Time));
    pRecordset->Update();///保存到库中
    pRecordset->Close();
      

  6.   

    VC的ADO数据库查询与增删改操作实例,看完后你就知道了:http://www.maoyeah.com/display.asp?boardid=3&id=43
      

  7.   

    利用ADO:
    _ConnectionPtr cnn;
    CString sSql;
    sSql.Format("INSERT INTO 表名  values('%s','%s','%s'),s0,s1,s2);
    cnn->Execute((_bstr_t)sSql,NULL,adCmdText);
      

  8.   

    用ADO吧,http://www.vckbase.com上有很多代码可用