wpf - How to retrieve values from multiple rows of the same column in SQL Server -


i need search booked patients given date. don"t know error in code is. retrieve 1 row table. please help

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 patients1  booking_dt=@dt ";  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()); } 

i'd it's your

if (dr.read()) { } 

block running once. don't know specifics of whichever language you're using, i'm guessing need along lines of

while (dr.read()) {     listview1.items.add(dr[1].tostring()); } 

which should iterate through dr.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -