“图片”字段  在access里 设成“备注”,那么在sql server里使用二进制还是image呢

解决方案 »

  1.   

    在access 应该设置成 ole,在sql 应该使用二进制
      

  2.   

    楼上的 那个早改了,我是说数据库表的字段问题,
    谢谢clh111
    原来的图片字段是 image 16 改成binary 5000 后 提示要用convert函数转换的错误信息
     于是又改回 image 16 ,
    运行结果出人意料:这次没有返回错误提示,而是回到操作成功界面shownews.aspx,但点击进入detailnews.aspx呈现图像错误显示的图标,(在测验数据的图片为空时,还都一切正常)
    我该怎么办?        !全是眼泪!
      

  3.   

    我有自己做的代码(好使的)。[email protected]
      

  4.   

    还是那个问题,又困扰了我一上午,其他的功能还好的,唯独这个了   !全是眼泪!添加新闻页面,包括图片路径>>>点发表进入浏览新闻界面>>>点刚刚添加的新闻标题>>>进入浏览该条新闻:问题————显示图片的位置:呈现图像错误显示的图标
      

  5.   

    http://expert.csdn.net/Expert/topic/2493/2493940.xml?temp=.7637293
    image字段和其他字段不太一样,必须要申明一个变量
      

  6.   

    你的那问题就是如何使图片存库与读库,要用ole类型,同时使用Filestream来对图片进行处理,我以前就遇到过这样的问题,后来解决了,如下代码
    存库过程:
    string str=@"c:\mypicture.gif";
    FileStream file =  new FileStream(str,FileMode.Open, FileAccess.Read);
    Byte[] bytBLOBData = new Byte[file.Length]; 
    file.Read(bytBLOBData, 0, bytBLOBData.Length);
    file.Close();
    OleDbCommand olecommand=new OleDbCommand("INSERT INTO 图表细节(图档内容) values(?)",oleDbConnection1);
    olecommand.Parameters.Add(new OleDbParameter("jpeg",OleDbType.Binary,bytBLOBData.Length,ParameterDirection.Input,true,0,0,null,DataRowVersion.Default,bytBLOBData));
    oleDbConnection1.Open();
    olecommand.ExecuteScalar();
    oleDbDataAdapter1.Update(ds1111);
    读库过程:
    byteBLOBData = (Byte[])(read["图档内容"]);
    MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
    pictureBox1.Image=Image.FromStream(stmBLOBData);
    解决好了
      

  7.   

    .aspx 代码但在属性栏里没有Accept属性 是不是这里错了,那要如何改:
    <td width="73%">图片: <input id="File1" type=file  Accept="Image/*" runat="server" NAME="File1">.cs 的这部分代码
          
      ******SqlCommand myCommand = new SqlCommand("insert into tdnews (标题, 内文,zuozhe,开始日期,click,图片,重要性) values ('" + 标题.Text.ToString() + "', '" + 内文.Text.ToString() + "','" + zuozhe.Text.ToString() + "','" + DateTime.Now.ToString() + "',0,'" + Path.GetFileName(File1.PostedFile.FileName) + "','" + DropDownList2.SelectedItem.Value+ "')" , myConnection);
             myCommand.Connection.Open(); myCommand.ExecuteNonQuery();  
    myCommand.Connection.Close(); 
    Response.Redirect("shownews.aspx") ; 
    }
            
    }   public void reset_Click(Object sender,EventArgs e)
    {
    标题.Text="";
    内文.Text="";
    zuozhe.Text="";
    }  
      

  8.   

    我用的是sql
    oledb全改成sql是吗
      

  9.   

    .aspx 代码
    <td width="73%">图片: <input id="File1" type=file  Accept="Image/*" runat="server" NAME="File1">
    在属性栏里没有Accept属性 是不是这里错了,那要如何改: