日期:2014-05-19  浏览次数:20533 次

如何将流存入表的某一列中,能成功加载文件如流,不知道如何添加到数据库;
_StreamPtr   m_stream;
m_stream.CreateInstance( "ADODB.Stream ");
_variant_t   vtEmpty   (DISP_E_PARAMNOTFOUND,   VT_ERROR);
m_stream-> PutType(adTypeBinary);
m_stream-> Open(vtEmpty,adModeUnknown,adOpenStreamUnspecified,L " ",L " ");
m_stream-> LoadFromFile(_bstr_t( "d:/1.txt "));
//能够成功加载文件,但是不知道如何将该流添加到数据库的_RecordsetPtr中;
_RecordsetPtr   m_pRecordset;
_ConnectionPtr   m_pConnection;
m_pConnection.CreateInstance( "ADODB.Connection ");
m_pRecordset.CreateInstance( "ADODB.Recordset ");
m_pConnection-> Open( "DataSource=suixin;UID=;PWD=; ", " ", " ",adConnectUnspecified);
m_pRecordset-> Open( "select   *   from   big_number ",variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdUnknown);
//想将流存入表big_number中的数据列中;但无法实现
m_pRecordset-> Fields( "数据 ")=((char*)(_bstr_t)m_stream-> Read(adReadAll));


------解决方案--------------------
http://dotnet.aspx.cc/ShowDetail.aspx?id=J9UBRVER-L3VB-49M3-GOU1-Z6C2PVR6FZ3K
上面有介绍,他是将图片转化为流,然后保存到SQL
------解决方案--------------------
 
VB6向SQL SERVER存入图象:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;258038

VB.NET向SQL SERVER存入图象:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;308042

C#向SQL SERVER存入图象:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158
------解决方案--------------------
二进制流~
------解决方案--------------------
mark...