我建了个access数据库,
字段:ID(long),图片名(string),图片实体(不知道什么类型?在oracle里为blob,可在这个里面我不知道是什么了)每次选择一个图片,读成二进制保存到数据库,可不知道图片实体字段为什么类型?
还请大家提示一下。

解决方案 »

  1.   

    OLE 对象 Microsoft Access 表中链接或嵌入的对象(例如 Microsoft Excel 电子表格、Microsoft Word 文档、图形、声音或其他二进制数据)。 最多为 1 G 字节(受可用磁盘空间限制)。
      

  2.   

    byte[] MyData= new byte[0];
       
    da.Fill(ds, "MyImages");
    DataRow myRow;
    myRow=ds.Tables["MyImages"].Rows[0];
               
    MyData =  (byte[])myRow["imgField"];
    int ArraySize = new int();
    ArraySize = MyData.GetUpperBound(0); FileStream fs = new FileStream(@"C:\winnt\Gone Fishing2.BMP", FileMode.OpenOrCreate, FileAccess.Write);
    fs.Write(MyData, 0,ArraySize);
    fs.Close();
      

  3.   

    谢谢dlzhangln(一损俱损,一了百了!)
    我先试一下
      

  4.   

    如何在数据库中保存不同类型的文件
    http://blog.csdn.net/knight94/archive/2006/03/24/637800.aspx
      

  5.   

    OdbcDataAdapter pDataAdpter = ClsDbService.ExecuteAdapter("select * from TEST");
    byte[] MyData= new byte[0];
    DataSet ds = new DataSet();
    pDataAdpter.Fill(ds, "TEST");
    DataRow myRow;
    myRow=ds.Tables["tEST"].Rows[0];
               
    MyData =  (byte[])myRow["FileData"];
    int ArraySize = new int();
    ArraySize = MyData.GetUpperBound(0);  FileStream fs = new FileStream(@"C:\1.gif", FileMode.OpenOrCreate, FileAccess.Write);
    fs.Write(MyData, 0,ArraySize);
    fs.Close();在“MyData =  (byte[])myRow["FileData"];”处,执行总是出错,因为我的filedata字段是空的?//////////////////////////////////////////////////////////
    我的TEST表结构是
    id:自增
    filedata :ole对象
    filename :文本目前表里有2条记录,但2条记录里只有fiename有值,filedata没值,这段程序我该怎么改呢?望高手指点!
      

  6.   

    另外下面的方法也出了个错,不知道什么意思,明明我已经传了1个参数了,报错:说参数的期望为1???                                     FileInfo fi = new FileInfo( @"C:\1.gif" );
    if ( fi.Exists)
    {
    byte[] bData = null;

    using ( FileStream fs = fi.OpenRead())
    {
    bData = new byte[fi.Length];
    int nReadLength = fs.Read( bData,0, (int)(fi.Length) );
    }

    string strQuery = "INSERT INTO TEST " 
    + " ( FILEDATA) "
    + " VALUES "
    + " (:FILEDATA_) ";
    OdbcCommand OdbcComm = new  OdbcCommand( strQuery,ClsDbService.GetConn);// OdbcParameter pFileNamePara = new  OdbcParameter("FileName_",OdbcType.VarChar);
    // pFileNamePara.Direction = ParameterDirection.Input;
    // pFileNamePara.Value  = "af";

    OdbcParameter pFileDataPara = new  OdbcParameter("FILEDATA_",OdbcType.Image);
    pFileDataPara.Direction = ParameterDirection.Input;
    pFileDataPara.Value  =  bData; //OdbcComm.Parameters.Add(pFileNamePara);
    OdbcComm.Parameters.Add(pFileDataPara);
    OdbcComm.ExecuteNonQuery();
    ClsDbService.ExecuteNonQuery("Commit");
    望高手帮看看
      

  7.   

    filedata没值?你得先添加http://dotnet.aspx.cc/ShowDetail.aspx?id=9154BC99-DF64-4E2D-B096-26C99CE464BE
      

  8.   

    错误提示:ERROR [HY104] [Microsoft][ODBC Microsoft Access Driver]非法的精确度数值
    是什么意思?
      

  9.   

    System.Data.OleDb.OleDbParameter paramPersonImage = new OleDbParameter("@PersonImage", System.Data.OleDb.OleDbType.Binary); 
    paramPersonImage.Value = fileData;
    command.Parameters.Add(paramPersonImage);
    请问一下,对应的表中的PersonImage字段的类型是什么??是ole对象吗??
      

  10.   

    http://panda.h70.1stxy.net/ViewArticle.aspx?articleId=415
      

  11.   

    请问大家,access中那个保存图片二进制的字段的类型应该设置为什么??ole对象??
      

  12.   

    请问大家,access中那个保存图片二进制的字段的类型应该设置为什么??ole对象??
    保存的时候总出错:ERROR [HY104] [Microsoft][ODBC Microsoft Access Driver]非法的精确度数值