文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ASP.NET 文件操作实例

ASP.NET 文件操作实例

时间:2011-05-29  来源:叮/当

//文件使用FileUpload打开

if (FileUpload1.HasFile)
        {
            try
            {

                        //流读取
                StreamReader sr = new StreamReader(FileUpload1.FileContent);
                while (!sr.EndOfStream)
                {
                    string single = sr.ReadLine(); //读取一行
                    char[] b = { ',', '.' };
                    string[] sims = single.Split(b);
                    if (sims.Length < 2)
                    {
                        Label6.Text=sims[0]+ " 输入格式不正确,请将号码与PUK2码用','或'.'分隔'";
                        return;
                    }
                    if (sims[0].Length != 11)
                    {
                        Label6.Text = sims[0] + " 号码位数不正确";
                        return;
                    }
                    if (ListBox1.Items.FindByText(sims[0]) != null) //在下面列表框查找重复号码
                    {
                        Label6.Text = sims[0] + "号码被重复输入";
                        return;
                    }

                    

                    string simgroup1 = SimGroupContrl.SimGrouping(sims[0]); //号码分组模块

                    ListItem li = new ListItem(sims[0] + "," + sims[1] + "," + simgroup1);//添加 单行列表项
                    ListBox1.Items.Add(li); //读一行添加一行

                }
            }
            catch(Exception ex)
            {
                Label6.Text = ex.Message;
            }
        }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载