查询加上条件即可。
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "server=.;database=yourdb;uid=sa;pwd=pwd";
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "select regdate from yourtable where carNO=@no";
cmd.Parameters.AddWithValue("@no",textBox1.Text.Trim());
var date = cmd.ExecuteScalar();
cn.Close();
if(date!=System.DBNull.Value )
{
this.textBox2.Text = date.ToString();
}
C#如何以TEXTBOX控件中输入的内容查找数据库其他内容
最新推荐文章于 2023-05-23 17:34:41 发布