這個不知道對你有沒能用哦                                  DataRow dr = t.Rows.Find(new object[]{intLSH});
byte[] mydata = ((byte[])dr["TZ"]);
FileStream newFile = null;
newFile = new FileStream("aaa.dwg",FileMode.Create);
newFile.Write(mydata,0,mydata.Length);
newFile.Close();

解决方案 »

  1.   

    Structure CustomerRecord 
       Public OrderNumber As Integer
       Public Name As String
       Public OrderDate As Date
    End StructureSub WriteData()
       Dim MyRecord As CustomerRecord
       Dim RecordNumber As Integer
       Dim RecordDate As Date
       ' 打开文件进行随机访问。
       FileOpen(1, "C:\TESTFILE.txt", OpenMode.Binary)
       For RecordNumber = 1 To 3   ' 循环 3 次。
          MyRecord.OrderNumber = RecordNumber    ' 定义 OrderNumber。
          MyRecord.OrderDate = RecordDate          ' 定义 OrderDate。
          MyRecord.Name = "我的姓名" & RecordNumber ' 创建字符串。
          FilePut(1, MyRecord)                 ' 将记录写入文件。
       Next RecordNumber
       FileClose(1)
    End Sub
      

  2.   

    换句话说吧,我现在已经有一个字串"145  tghd 为什么",如果想将该字串写进文件中,该怎么处理?(注:该字串中有全角文字)
      

  3.   

    FileStream fs=new FileStream(@"test.log",FileMode.Create,FileAccess.Write);//写入字节
    byte theByte=100;
    fs.WriteByte(theByte);//写入字节数组
    byte[] theBytes;//实际写入时需要初始化该数组
    int nBytes;      //实际写入时需要初始化,写入的字节数
    fs.Write(theBytes,0,nBytes);
      

  4.   

    string s="145  tghd 为什么";byte[] theBytes=SysTem.Text.Encoding.GetBytes(s);然后再将之写入文件。
      

  5.   

    private const string FILE_NAME = @"C:\Documents and Settings\Administrator\桌面\Win Odds.htm";
    private const string file_name = @"C:\Documents and Settings\Administrator\桌面\Win.txt";
    private void button1_Click(object sender, System.EventArgs e)
    {
    if (!File.Exists(FILE_NAME)) 
    {
    Console.WriteLine("{0} does not exist.", FILE_NAME);
    return;
    } //以繁体字的encoding形式读取文件
    StreamReader sr = new StreamReader(FILE_NAME,System.Text.Encoding.GetEncoding(950) ,true,200);

    //以简体字的encoding写入文件
    // StreamWriter sw= new StreamWriter(file_name,false,System.Text.Encoding.GetEncoding(936),200);
    String input;
    input=sr.ReadToEnd();
    RG(input,sr);

    Console.WriteLine ("The end of the stream has been reached.");
    sr.Close();
    }
    private void RG(string inputString,System.IO.StreamReader  ss)
    {
     System.Text.RegularExpressions.Regex r;
    System.Text.RegularExpressions.Match m;

    StreamWriter sw= new StreamWriter(file_name,false,System.Text.Encoding.GetEncoding(936),200);
    String input;
    input=ss.ReadLine ();
                
     
    r = new System.Text.RegularExpressions.Regex(">(\\S)([^陣容往績心水推介賠率走勢圖][^(\\<*\\>)]*)<\\S",System.Text.RegularExpressions.RegexOptions.IgnoreCase|System.Text.RegularExpressions.RegexOptions.Compiled  );
    for (m = r.Match(inputString); m.Success; m = m.NextMatch()) 
    {
    sw.WriteLine(m.ToString());

    }
    sw.Close();
    }
    以前的一部分代码,没整理,乱了点。
    读写文件什么的都在里面了。
      

  6.   

    大侠win911(Young),强~~~~~~~~~~~~~~~~~~~~