大家好,我有这个代码:
SqlCommand scom = new SqlCommand(
"INSERT INTO klient(name,surname)
values(@kname,@ksurname)",
conn);
scom.Parameters.AddWithValue("@kname", kname.Text);
scom.Parameters.AddWithValue("@ksurname", ksurname.Text);
conn.Open();
DataTable dt = new DataTable();
SqlDataAdapter SDA = new SqlDataAdapter("SELECT * FROM klient", spojeni);
SDA.Fill(dt);
conn.Close();
它应该从文本框插入数据:kname、ksurname,但它会关闭表单而不在 MS SQL 表客户端中显示它们