为何显示空数据

时间:2017-04-02 13:08:49

标签: c# html sql

SqlConnection conn = new SqlConnection(@"Data Source=OWNER-PC\SQLEXPRESS;Initial Catalog=Crmstart;Integrated Security=True");
string connectionString = ConfigurationManager.ConnectionStrings["Scon"].ConnectionString;

protected void Page_Load(object sender, EventArgs e)
{
    getStudentData();
}

protected void Button1_Click(object sender, EventArgs e)
{
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandType = System.Data.CommandType.Text;
        cmd.CommandText = "INSERT INTO dbo.staff (First_Name, Last_Name, Father_Name, Address, Contact_No, NIC_No, Other_Info) VALUES (@fName, @lName, @FATHERName, @AName, @CName, @NICName, @OName)";

        cmd.Parameters.Add("@fName", SqlDbType.VarChar).Value = t1.Value;
        cmd.Parameters.Add("@lName", SqlDbType.VarChar).Value = t2.Value;
        cmd.Parameters.Add("@FATHERName", SqlDbType.VarChar).Value = t3.Value;
        cmd.Parameters.Add("@AName", SqlDbType.VarChar).Value = t4.Value;
        cmd.Parameters.Add("@CName", SqlDbType.VarChar).Value = t5.Value;
        cmd.Parameters.Add("@NICName", SqlDbType.VarChar).Value = t6.Value;
        cmd.Parameters.Add("@OName", SqlDbType.VarChar).Value = t7.Value;

        cmd.ExecuteNonQuery();

        getStudentData();
        conn.Close();
    }

当我使用此代码插入数据时,我的html表显示空行,它没有显示任何数据,只是递增序列号我不知道该怎么办请帮助

0 个答案:

没有答案