报必须声明标量变量 "@Number"错误,各位大侠帮忙看一下
using (SqlConnection conn = new SqlConnection(connstr))
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "Insert into T_number(number,promary,city,name) values(@Number,@Promary,@City,@Name)";
foreach (string file in files)
{
string[] lines = File.ReadAllLines(file, Encoding.Default);
foreach (string line in lines)
{
string[] strs = line.Split(' ');
string Number=strs[0];
string Promary=strs[1];
string City=strs[2];
string Name = strs[3];
cmd.Parameters.Clear();
cmd.Parameters.Add(new SqlParameter("nubmer", Number));
cmd.Parameters.Add(new SqlParameter("promary", Promary));
cmd.Parameters.Add(new SqlParameter("city", City));
cmd.Parameters.Add(new SqlParameter("name", Name));
cmd.ExecuteNonQuery();