日期:2014-05-17  浏览次数:21004 次

奇怪的问题 串口通信程序将txt数据保存进access中产生


private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = @"c:\";
            openFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                int n = 0;
                string fname = openFileDialog1.FileName;
                StreamReader sr = new StreamReader(@fname, System.Text.Encoding.GetEncoding("gb2312"));
                char[] parsChar = { ' ' };
                string water = string.Empty;
                string date1 = string.Empty;
                string time1 = string.Empty;
                string temp = string.Empty;
                string date2 = string.Empty;
                string time2 = string.Empty;
                string space = string.Empty;
                string sctemp = textBox1.Text;
                string tmpLine;
                string splitline;
                string[] line; //string[] line2;
                while ((tmpLine = sr.ReadLine()) != null)