如果在sql server2000中存、读JPG文件
如果用VC写一个程序在sql server2000中存、读JPG文件及avi文件

解决方案 »

  1.   

    DWORD len;
    COleVariant v("媒体文档",VT_BSTR);

    //BYTE *lpBuffer;
    CByteArray byArr; if(strMediapathname.GetLength ()!=0)
    {
    CFile fl(strMediapathname,CFile::modeRead);
    len=fl.GetLength();
    byArr.SetSize (len);
    fl.ReadHuge (byArr.GetData (),len);
    fl.Close ();
    }
    /////////////////////////////////////////////////////

    try
    { _variant_t vDevtype, vDevname;
    //_variant_t vExptype, vExpname;

    CString strDevtype, strDevname;
    //CString strExptype, strExpname;

    m_adoRsDevice ->Book = pComboDevtype ->GetSelectedItem ();
    vDevname = m_adoRsDevice ->GetCollect ( "设备类型" );
    vDevtype = m_adoRsDevice ->GetCollect ( "设备编号" );
    strDevtype = vDevtype.bstrVal ;
    strDevname = vDevname.bstrVal ; // m_adoRsExperimentation ->Book = pComboExptype ->GetSelectedItem ();
    // vExpname = m_adoRsExperimentation ->GetCollect ( "试验名称" );
    // vExptype = m_adoRsExperimentation ->GetCollect ( "试验编号" );
    // strExptype = vExptype.bstrVal ;
    // strExpname = vExpname.bstrVal ;

    if ( bNew ) // 添加新记录
    {
    /////////////////////////////////////////
    //
    // 检查编号,防止冲突
    //
    RefreshRs (); ConnectTo ( m_adoRsMaxReferenceID, theApp.m_adoConnection );
    m_adoRsMaxReferenceID ->Requery ( adOptionUnspecified );
    DisConnect ( m_adoRsMaxReferenceID );

    if ( m_adoRsMaxReferenceID ->GetRecordCount () > 0 )
    {
    _variant_t v = m_adoRsMaxReferenceID ->GetCollect ( 0L );


    if ( v.vt != VT_NULL )
    {
    strReferenceID = v.bstrVal ;
    m_adoRecordset ->PutCollect ( "媒体文件名", strMedianame.AllocSysString () );

    // m_adoRecordset ->Update ();
    }
      

  2.   

    在VCKBASE里面有个读写BLOB类型的程序看看或许对你有好处