I have a gridview which should display only usernames based on the email written in textbox1 and textbox2. How can I do this? I bound the gridview to a sql data source and in tht, I used the where clause like
SELECT [Username] FROM [Users] WHERE (([Email] = @Email) AND ([Email] = @Email2))
Where control ID on email is textbox 1 and control ID of email2 is textbox 2. But the result is null. The gridview is not displaying anything.
is the correct SELECT statement.
Alternatively, you could do
(note the OR instead of AND)
The problem with your SELECT is that it retrieves the rows that are equal to both @Email and @Email2. You could test that by trying to set the same email value in both text boxes – that should bring some results.