“System.ArgumentException”类型的未经处理的异常出现在 System.Data.dll 中。 5
做的手号码归属地查询,代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;...
做的手号码归属地查询,代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Configuration;
using System.Data.SqlClient;
//using System.Data.SqlClient;
namespace 手机地址归属地查询
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnImport_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
if (dlg.ShowDialog() != DialogResult.OK)
{
return;
}
string path = dlg.SelectedPath;
string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connStr))
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "delete from T_Numbers";
cmd.ExecuteNonQuery();
}
}
string[] files = Directory.GetFiles(path, "*.txt", SearchOption.AllDirectories);
foreach(string file in files)
{
string 运营商名称 = Path.GetFileNameWithoutExtension(file);
MessageBox.Show(运营商名称);
string[] lines = File.ReadAllLines(file, Encoding.Default);
foreach (string line in lines)
{
MessageBox.Show(line);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
} 展开
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Configuration;
using System.Data.SqlClient;
//using System.Data.SqlClient;
namespace 手机地址归属地查询
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnImport_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
if (dlg.ShowDialog() != DialogResult.OK)
{
return;
}
string path = dlg.SelectedPath;
string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connStr))
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "delete from T_Numbers";
cmd.ExecuteNonQuery();
}
}
string[] files = Directory.GetFiles(path, "*.txt", SearchOption.AllDirectories);
foreach(string file in files)
{
string 运营商名称 = Path.GetFileNameWithoutExtension(file);
MessageBox.Show(运营商名称);
string[] lines = File.ReadAllLines(file, Encoding.Default);
foreach (string line in lines)
{
MessageBox.Show(line);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
您可能需要的服务
百度律临官方认证律师咨询
平均3分钟响应
|
问题解决率99%
|
24小时在线
立即免费咨询律师
13257人正在获得一对一解答
杭州雪花飘飘5分钟前提交了问题
济南夏日炎炎4分钟前提交了问题
杭州雪花飘飘5分钟前提交了问题