see:byte[] ib=new Byte[60000];
FileStream fs=new FileStream(@"D:\windows temp\temp\1.jpg",FileMode.Open ,FileAccess.Read );
fs.Read(ib,0,60000);DataTable.Rows[1][1].Value=ib;

解决方案 »

  1.   

    把RichTextBox中的文本保存到Sql Server中 
    http://www.cnblogs.com/dahuzizyd/archive/2004/07/27/27787.aspx
      

  2.   

    //保存文件数据到数据库
    DataRow dr = this.datasetEDI1.Tables["DataDownload"].NewRow();
    dr["UserId"] = fileName.Substring(4,4);
    dr["Content"] = content; //Content为text字段,用来存放文件
    this.datasetEDI1.Tables["DataDownload"].Rows.Add(dr);da.Update(this.datasetEDI1,"DataDownload");
      

  3.   

    //读取数据库字段到文件,Content为Text字段,存放文件
    SqlCommand cmd = new SqlCommand("Select Content From " + tableName + " where DataId = '" + id + "'",this.sqlConnection1);string aaa = cmd.ExecuteScalar().ToString();
    StreamWriter sw = null;
    try
    {
      sw= new StreamWriter(fileName,false,System.Text.Encoding.GetEncoding("GB2312"));
      sw.Write(aaa);
      sw.Flush();
      MessageBox.Show("生成报文成功!");
    }
    catch(Exception ex)
    {
      MessageBox.Show("文件生成失败:" + ex.Message);
    }
    finally
    {
      sw.Close();
    }