如何把文本框得到的数据转换成int型呢SqlCommand cmd = new SqlCommand("Select * from t09.cfnr where dnbxlh = @id", con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
cmd.Parameters.AddWithValue("@id",textBox1.Text);因为dnbxlh是int型的
SqlDataAdapter adp = new SqlDataAdapter(cmd);
cmd.Parameters.AddWithValue("@id",textBox1.Text);因为dnbxlh是int型的
if (int.TryParse(textBox1.Text, out _Value))
{ SqlCommand cmd = new SqlCommand("Select * from t09.cfnr where dnbxlh = @id", con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
cmd.Parameters.AddWithValue("@id", _Value);
}