|
大家好我有个问题
现在我有一个数据文件,文件中有9条数据
其中每条数据前10位是数字
例如这样:
0006461311 041CUSTOMER NAME - ......
0005473684 011CUSTOMER NAME - ......
......
0003026870*811CUSTOMER NAME - ......
现在我这样写:
long no = 1000000000;
StreamReader sr = new StreamReader(@"E:\GAPBIL.DAT");
string strRecord = sr.ReadLine();
List<string> strList = new List<string>();
while (strRecord != null)
{
strRecord = no.ToString() + strRecord.Substring(10);
strList.Add(strRecord);
no++;
strRecord = sr.ReadLine();
}
StreamWriter sw = new StreamWriter(@"E:\GABill_1Wline.txt");
int i = 0;
while (i < 10000)
{
for (int j = 0; j < strList.Count; j++)
{
sw.WriteLine(strList[j]);
i++;
}
}
sw.Close();
出现的结果是这9条数据不断的循环产生,直到出现 1W条+8条 为止
1000000000 041CUSTOMER NAME - ......
1000000001 011CUSTOMER NAME - ......
......
1000000008*811CUSTOMER NAME - ......
1000000000 041CUSTOMER NAME - ......
1000000001 011CUSTOMER NAME - ......
......
1000000008*811CUSTOMER NAME - ......
......
......
......
可是我的目的是想这9条数据不断回滚,切前面的10位数字还要不断递加(就是每条数据除了前10位数字递加外,后面的部分不断回滚)例如这样
1000000000 041CUSTOMER NAME - ......
1000000001 011CUSTOMER NAME - ......
......
1000000008*811CUSTOMER NAME - ......
1000000009 041CUSTOMER NAME - ......
1000000010 011CUSTOMER NAME - ......
......
1000000017*811CUSTOMER NAME - ......
.....
.....
.....
应该怎么做,急在线等 ... (试了下,要不是只读一条数据不断递加,要不就是9跳不断回滚,不能时间,前面10个递加,后面的数据回滚) |
|