How to show all record from database using c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to show all record from database using c#

i have use following qyery but when i click on button it return only one row from database i need to returns all row which contain [email protected] any one can help "select * from DBname where email = "[email protected]"

3rd Dec 2017, 2:12 PM
RAJ PATIL
RAJ PATIL - avatar
2 Answers
0
The where clause selects a single record or more if more records have the same e-mail. You need "select e-mail from DBname" To select the columnname and all the records
3rd Dec 2017, 4:11 PM
sneeze
sneeze - avatar
0
i use the exact syntax you have in my code, to return all matching rows. if you are passing to something that cant handle more than one result, you will only get one result. also, watch for typos. if your query contains a typo, it wont complain. i dont have experience with sql, but rather sqlite. can you give more detail on your example code? i use: "SELECT * FROM DBname WHERE ColumnName = '" + StringVar + "'"; and it works for me. i pass the result to a datatable.
3rd Dec 2017, 7:38 PM
Dan Robbins
Dan Robbins - avatar