C#实现逐行读取和写入文件的方法

 更新时间:2024年01月30日 10:12:25   作者:雪域迷影  
这篇文章给大家介绍了使用C#语言实现同样的功能,即从输入文件中读取每行数据,然后将每行字段组合成SQL插入脚本,然后逐行写入另外一个空白文件中,感兴趣的朋友可以参考下

tb_param表的结构

tb_param表的结构如下:

tb_param

tb_data

创建表的SQL脚本如下,我使用的是Sqlite数据库

 DROP TABLE IF EXISTS "main"."tb_param";
CREATE TABLE tb_param(protocol INT NOT NULL,slave INT NOT NULL,number INT NOT NULL,ptype INT NOT NULL,pid INT NOT NULL,name TEXT NOT NULL,format TEXT,PRIMARY KEY(protocol,slave,number,ptype,pid));

前面使用nodejs实现从input.txt文件逐行读取数据,然后将每行数据拼接成如下的数据格式:

INSERT INTO tb_param (protocol, slave, number, ptype, pid, name, format) 
VALUES (2, 6, 0, 1, 1, 'a34004', .0);

输入文件 input.txt示例如下:

2	24	0	1	1	a04005	.3
2	24	0	1	2	a04006	.3
2	24	0	1	3	a04007	.3
2	16	0	1	1	a99501	.3
2	16	0	1	2	a99502	.3
2	16	0	1	3	a99500	.3
2	16	0	1	4	a99505	.3
2	16	0	1	5	a99504	.3
2	16	0	1	6	a99503	.3
2	22	0	1	23	a24901	.3
2	22	0	1	27	a24904	.3
2	22	0	1	28	a24905	.3
2	22	0	1	29	a24042	.3
2	22	0	1	36	a25002	.3
2	22	0	1	33	a24036	.3
2	22	0	1	32	a24908	.3
2	22	0	1	34	a24909	.3
2	22	0	1	35	a24910	.3
2	22	0	1	37	a24012	.3
2	22	0	1	38	a24043	.3
2	22	0	1	39	a24084	.3
2	22	0	1	40	a24911	.3
2	22	0	1	43	a25003	.3
2	22	0	1	41	a24912	.3
2	22	0	1	42	a24913	.3
2	22	0	1	44	a24070	.3
2	22	0	1	45	a25004	.3
2	22	0	1	47	a25008	.3
2	22	0	1	49	a25038	.3
2	22	0	1	48	a25006	.3
2	22	0	1	46	a24044	.3
2	22	0	1	50	a25034	.3
2	22	0	1	51	a25033	.3
2	22	0	1	52	a25902	.3
2	22	0	1	53	a25014	.3
2	22	0	1	55	a25021	.3
2	22	0	1	56	a25901	.3
2	22	0	1	57	a25019	.3
2	22	0	1	54	a24068	.3
2	22	0	1	58	a25020	.3
2	22	0	1	59	a25903	.3
2	22	0	1	60	a25904	.3
2	22	0	1	61	a24914	.3
2	22	0	1	62	a24915	.3
2	22	0	1	1	a24001	.3
2	22	0	1	2	a24045	.3
2	22	0	1	3	a24002	.3
2	22	0	1	4	a24053	.3
2	22	0	1	5	a24038	.3
2	22	0	1	6	a24037	.3
2	22	0	1	7	a24079	.3
2	22	0	1	8	a24064	.3
2	22	0	1	11	a24063	.3
2	22	0	1	12	a24902	.3
2	22	0	1	13	a24041	.3
2	22	0	1	14	a24039	.3
2	22	0	1	20	a24077	.3
2	22	0	1	18	a24074	.3
2	22	0	1	22	a24076	.3
2	22	0	1	31	a24907	.3
2	22	0	1	24	a24903	.3
2	22	0	1	25	a24011	.3
2	22	0	1	21	a24061	.3
2	22	0	1	30	a24906	.3
2	22	0	1	104	a31005	.3
2	22	0	1	206	a24072	.3
2	22	0	1	221	a05009	.3
2	22	0	1	65	a05014	.3
2	22	0	1	66	a24099	.3
2	22	0	1	67	a24046	.3
2	22	0	1	15	a24078	.3
2	22	0	1	68	a24008	.3
2	22	0	1	69	a24015	.3
2	22	0	1	70	a24916	.3
2	22	0	1	96	a31004	.3
2	22	0	1	97	a31003	.3
2	22	0	1	72	a24047	.3
2	22	0	1	71	a05013	.3
2	22	0	1	98	a31024	.3
2	22	0	1	73	a24100	.3
2	22	0	1	74	a24003	.3
2	22	0	1	101	a28006	.3
2	22	0	1	75	a24016	.3
2	22	0	1	76	a24111	.3
2	22	0	1	77	a24004	.3
2	22	0	1	78	a24018	.3
2	22	0	1	79	a24005	.3
2	22	0	1	80	a24017	.3
2	22	0	1	81	a24049	.3
2	22	0	1	82	a24027	.3
2	22	0	1	83	a24007	.3
2	22	0	1	85	a24112	.3
2	22	0	1	84	a24054	.3
2	22	0	1	86	a24019	.3
2	22	0	1	87	a24050	.3
2	22	0	1	88	a24034	.3
2	22	0	1	89	a25010	.3
2	22	0	1	90	a24009	.3
2	22	0	1	91	a24020	.3
2	22	0	1	92	a25012	.3
2	22	0	1	95	a25011	.3
2	22	0	1	215	a30008	.3
2	22	0	1	219	a99051	.3
2	22	0	1	201	a29026	.3
2	22	0	1	208	a29017	.3
2	22	0	1	106	a31025	.3
2	22	0	1	209	a24110	.3
2	22	0	1	203	a25072	.3
2	22	0	1	222	a29015	.3
2	22	0	1	202	a31030	.3
2	22	0	1	211	a31027	.3
2	22	0	1	207	a24006	.3
2	22	0	1	93	a25013	.3
2	22	0	1	94	a25068	.3
2	22	0	1	204	a25015	.3
2	22	0	1	223	a24113	.3
2	22	0	1	224	a25059	.3
2	22	0	1	9	a24919	.3
2	22	0	1	213	a30003	.3
2	17	0	1	1	a99070	.0
2	17	0	1	2	a99071	.0
2	17	0	1	3	a99072	.0
2	17	0	1	4	a99073	.0
2	17	0	1	5	a99074	.0
2	17	0	1	6	a99075	.0
2	17	0	1	7	a99076	.0
2	17	0	1	8	a99077	.0
2	17	0	1	9	a99078	.0
2	17	0	1	10	a99079	.0
2	17	0	1	11	a99080	.0
2	17	0	1	12	a99081	.0
2	17	0	1	13	a99082	.0
2	17	0	1	14	a99083	.0
2	17	0	1	15	a99084	.0
2	17	0	1	16	a99085	.0
2	17	0	1	17	a99086	.0
2	17	0	1	18	a99087	.0
2	17	0	1	19	a99088	.0
2	17	0	1	20	a99089	.0
2	17	0	1	21	a99090	.0
2	17	0	1	22	a99091	.0
2	17	0	1	23	a99092	.0
2	17	0	1	24	a99093	.0
2	17	0	1	25	a99094	.0
2	17	0	1	26	a99095	.0
2	17	0	1	27	a99096	.0
2	17	0	1	28	a99097	.0
2	17	0	1	29	a99098	.0
2	17	0	1	30	a99099	.0
2	17	0	1	31	a99100	.0
2	17	0	1	32	a99101	.0
2	17	0	1	35	a99102	.1
2	17	0	1	36	a99103	.1
2	17	0	1	37	a99104	.1

C#语言实现代码

Program.cs 代码如下:

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// c#逐行读取txt文件
// https://www.cnblogs.com/trvatwang/p/4602597.html
// C# 向文本文件中逐行读写文件
// https://blog.csdn.net/lovefenglinshi/article/details/24433177
// C# 逐行读取文本文件
// https://www.delftstack.com/zh/howto/csharp/how-to-read-a-text-file-line-by-line-in-csharp/

namespace ReadFiles
{
    class Program
    {
        private static String strFileName = @"./input.txt";
        static void Main(string[] args)
        {
            StreamWriter sw = new StreamWriter("./output.txt", true, System.Text.Encoding.Default);
            StreamReader sr = new StreamReader(strFileName);
            // 记录行号
            //int iLineNum = 0;
            while(!sr.EndOfStream)
            {
                string strLine = sr.ReadLine();
                //Console.WriteLine("{0} : {1}",++iLineNum, strLine);
                // 处理每一行数据
                String[] strColsArr = strLine.Split('\t');
                if (strColsArr.Length >= 7)
                {
                    try
                    {
                        int protocol = Convert.ToInt32(strColsArr[0]);
                        int slave = Convert.ToInt32(strColsArr[1]);
                        int number = Convert.ToInt32(strColsArr[2]);
                        int ptype = Convert.ToInt32(strColsArr[3]);
                        int pid = Convert.ToInt32(strColsArr[4]);

                        string strName = strColsArr[5];
                        string strFormat = strColsArr[6];

                        string strResult = string.Format("INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)\n " +
                            "VALUES({0}, {1}, {2}, {3}, {4}, '{5}', '{6}');", protocol, slave, number, ptype, pid, strName, strFormat);
                        Console.WriteLine(strResult);
                        sw.WriteLine(strResult);
                    }
                    catch(Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
            }
            sr.Close();
            sw.Close();
            Console.ReadKey();
        }
    }
}

运行上述代码并获得输出

在VS2017中运行上述C#控制台程序
得到输出文件output.txt如下所示:

INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 24, 0, 1, 1, 'a04005', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 24, 0, 1, 2, 'a04006', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 24, 0, 1, 3, 'a04007', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 1, 'a99501', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 2, 'a99502', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 3, 'a99500', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 4, 'a99505', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 5, 'a99504', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 16, 0, 1, 6, 'a99503', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 23, 'a24901', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 27, 'a24904', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 28, 'a24905', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 29, 'a24042', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 36, 'a25002', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 33, 'a24036', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 32, 'a24908', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 34, 'a24909', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 35, 'a24910', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 37, 'a24012', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 38, 'a24043', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 39, 'a24084', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 40, 'a24911', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 43, 'a25003', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 41, 'a24912', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 42, 'a24913', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 44, 'a24070', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 45, 'a25004', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 47, 'a25008', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 49, 'a25038', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 48, 'a25006', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 46, 'a24044', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 50, 'a25034', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 51, 'a25033', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 52, 'a25902', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 53, 'a25014', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 55, 'a25021', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 56, 'a25901', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 57, 'a25019', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 54, 'a24068', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 58, 'a25020', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 59, 'a25903', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 60, 'a25904', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 61, 'a24914', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 62, 'a24915', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 1, 'a24001', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 2, 'a24045', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 3, 'a24002', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 4, 'a24053', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 5, 'a24038', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 6, 'a24037', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 7, 'a24079', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 8, 'a24064', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 11, 'a24063', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 12, 'a24902', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 13, 'a24041', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 14, 'a24039', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 20, 'a24077', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 18, 'a24074', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 22, 'a24076', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 31, 'a24907', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 24, 'a24903', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 25, 'a24011', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 21, 'a24061', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 30, 'a24906', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 104, 'a31005', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 206, 'a24072', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 221, 'a05009', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 65, 'a05014', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 66, 'a24099', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 67, 'a24046', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 15, 'a24078', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 68, 'a24008', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 69, 'a24015', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 70, 'a24916', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 96, 'a31004', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 97, 'a31003', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 72, 'a24047', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 71, 'a05013', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 98, 'a31024', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 73, 'a24100', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 74, 'a24003', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 101, 'a28006', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 75, 'a24016', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 76, 'a24111', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 77, 'a24004', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 78, 'a24018', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 79, 'a24005', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 80, 'a24017', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 81, 'a24049', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 82, 'a24027', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 83, 'a24007', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 85, 'a24112', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 84, 'a24054', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 86, 'a24019', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 87, 'a24050', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 88, 'a24034', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 89, 'a25010', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 90, 'a24009', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 91, 'a24020', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 92, 'a25012', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 95, 'a25011', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 215, 'a30008', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 219, 'a99051', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 201, 'a29026', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 208, 'a29017', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 106, 'a31025', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 209, 'a24110', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 203, 'a25072', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 222, 'a29015', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 202, 'a31030', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 211, 'a31027', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 207, 'a24006', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 93, 'a25013', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 94, 'a25068', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 204, 'a25015', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 223, 'a24113', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 224, 'a25059', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 9, 'a24919', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 22, 0, 1, 213, 'a30003', '.3');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 1, 'a99070', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 2, 'a99071', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 3, 'a99072', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 4, 'a99073', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 5, 'a99074', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 6, 'a99075', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 7, 'a99076', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 8, 'a99077', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 9, 'a99078', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 10, 'a99079', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 11, 'a99080', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 12, 'a99081', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 13, 'a99082', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 14, 'a99083', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 15, 'a99084', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 16, 'a99085', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 17, 'a99086', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 18, 'a99087', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 19, 'a99088', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 20, 'a99089', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 21, 'a99090', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 22, 'a99091', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 23, 'a99092', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 24, 'a99093', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 25, 'a99094', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 26, 'a99095', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 27, 'a99096', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 28, 'a99097', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 29, 'a99098', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 30, 'a99099', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 31, 'a99100', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 32, 'a99101', '.0');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 35, 'a99102', '.1');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 36, 'a99103', '.1');
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
 VALUES(2, 17, 0, 1, 37, 'a99104', '.1');

小结

到此这篇关于C#实现逐行读取和写入文件的方法的文章就介绍到这了,更多相关C#逐行读取和写入文件内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • 使用接口实现多继承的方法

    使用接口实现多继承的方法

    下面小编就为大家分享一篇c#使用接口实现多继承的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2017-12-12
  • Unity Shader实现2D游戏迷雾

    Unity Shader实现2D游戏迷雾

    这篇文章主要为大家详细介绍了Unity Shader实现2D游戏迷雾,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-04-04
  • 利用C#如何给PDF文档添加文本与图片页眉

    利用C#如何给PDF文档添加文本与图片页眉

    页眉常用于显示文档的附加信息,我们可以在页眉中插入文本或者图形,例如,页码、日期、公司徽标、文档标题、文件名或作者名等等。那么我们如何以编程的方式添加页眉呢?这篇文章主要介绍了利用C#如何给PDF文档添加文本与图片页眉的相关资料,需要的朋友可以参考下
    2017-01-01
  • C#将布尔类型转换成字节数组的方法

    C#将布尔类型转换成字节数组的方法

    这篇文章主要介绍了C#将布尔类型转换成字节数组的方法,涉及C#中字符串函数的使用技巧,非常具有实用价值,需要的朋友可以参考下
    2015-04-04
  • 浅谈C#中的for循环与foreach循环

    浅谈C#中的for循环与foreach循环

    本篇文章主要介绍了C#中的for循环与foreach循环的相关知识,具有很好的参考价值。下面跟着小编一起来看下吧
    2017-05-05
  • C#中[]的几种用法示例代码

    C#中[]的几种用法示例代码

    不像数学里面有方括号和花括号,在C#语法中”[]”与”{}”有专门的用途,下面这篇文章主要给大家介绍了关于C#中[]的几种用法,需要的朋友可以参考下
    2023-01-01
  • C#导出pdf的实现方法(浏览器不预览直接下载)

    C#导出pdf的实现方法(浏览器不预览直接下载)

    这篇文章主要给大家介绍了关于C#导出pdf的实现方法,实现后浏览器不预览就可以直接下载,文中通过示例代码介绍的非常详细,对大家学习或者使用C#具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
    2019-12-12
  • C#微信开发(服务器配置)

    C#微信开发(服务器配置)

    这篇文章主要介绍了C#微信开发中有关服务器配置的相关内容,感兴趣的小伙伴们可以参考一下
    2015-11-11
  • C#验证码问题的快速解决方法

    C#验证码问题的快速解决方法

    下面小编就为大家带来一篇C#验证码问题的快速解决方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2016-07-07
  • 详解C#如何实现屏幕放大和取色功能

    详解C#如何实现屏幕放大和取色功能

    这篇文章主要为大家详细介绍了如何利用C#实现屏幕放大和取色功能,文中的示例代码讲解详细,对我们学习C#有一定的帮助,感兴趣的小伙伴可以了解一下
    2022-12-12

最新评论