str_File = str_File + dr["pinyin"].ToString() + "\t";
                        str_File = str_File + dr["ID"].ToString() + "\t";
                        str_File = str_File + dr["name"].ToString() + "\t";
                        str_File = str_File + la + "\t";
                        str_File = str_File + laa + "\t";
                        str_File = str_File + "\r\n";
                    }
                    la = "";
                    laa = "";
                    dr.Close();
                    if (File.Exists(save.FileName))
                    {
                        //MessageBox.Show("该文件已经存在!已经被删除,请重新再次导出即可");
                        //File.Delete(SaveFileName);
                        MessageBox.Show("该文件已经存在,请重新导出");
                        return;
                    }
                    else
                    {// new StreamWriter(save .FileName, true, System.Text.Encoding.GetEncoding("gb2312"))                        using (StreamWriter sw = new StreamWriter(save.FileName, true, System.Text.Encoding.GetEncoding("UTF-8")))
                        {
                            //创建文本文件   
                            sw.WriteLine(str_File);
                            sw.Flush();
                            sw.Close();
                        }                        MessageBox.Show("写入文件成功");
                    }
这里转成的TXT文本文档用EXCEL打开后,制表符没有起作用,于是我作了如下处理在\t后面加了一个逗号:
                        str_File = str_File + dr["pinyin"].ToString() + "\t,";
                        str_File = str_File + dr["ID"].ToString() + "\t,";
                        str_File = str_File + dr["name"].ToString() + "\t,";
                        str_File = str_File + la + "\t,";
                        str_File = str_File + laa + "\t,";
                        str_File = str_File + "\r\n";这样转成的文本文档用excel打开后还是表格的形式,但是如果我的数据中本身就有逗号,就会出错,要怎么将逗号转义,或都有其它更好的处理方式吗?