-1
我需要搜索给定日期的预订患者。我不“知道我的代码是什么错误。但我可以从表中检索只有1行。请帮助如何检索SQL Server中同一列的多行的值
string sp = textBox1.Text;
SqlConnection con1 = new SqlConnection();
con1.ConnectionString = "Data Source=SWATHI-PC\\NM;Initial Catalog=clinic;Persist Security Info=True;User ID=sa;Password=sqlpass";
con1.Open();
string query = "select Booking_dt,Name from patients1 WHERE [email protected] ";
SqlCommand cmd = new SqlCommand(query, con1);
cmd.Parameters.Add(new SqlParameter("@dt", sp));
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
listView1.Items.Add(dr[1].ToString());
}