Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Dear All,

I have a table as tblStudentsInfo with SId, SName, and Phone.

Now I want display SName and Phone using Repeater control.

If Phone has null values I want to disable SName column.
The expected output like,

tblStudentsInfo

SName Phone
----- ------
Sai 1234567890
Raju 1245678922
Alex null
Rabet null
Ramesh 1245678990
Posted
Updated 13-Dec-15 22:34pm
v3
Comments
Amit Jadli 14-Dec-15 3:31am    
You can put where clause in sql query..by that you will not get the rows who have null values...
Sinisa Hajnal 14-Dec-15 3:43am    
WHERE PHONE IS NULL. You didn't do any research and this is bad question because no attempt to solve the problem is apparent. My vote of 1.
Member 10021658 14-Dec-15 3:58am    
Dear Sinisa, Thanks for your reply.
Thanks
Member 10021658 14-Dec-15 4:00am    
Dear Sinisa, Thanks for your reply. I have already used where condition. But I need to display SName always and disable the address if Phone is null.
O/p
SName Address Phone
Sai Bglr 1234567890
Alex (Alex don't have phone so disabled the address data)
Raju hyd 1245678990

Thanks
Amit Jadli 14-Dec-15 4:09am    
Not clear what u wants to do...

1 solution

Use with and without where condition

SQL
SELECT sname,(ISNULL(phone,'disabled')) as phone,(ISNULL(address,'disabled')) as address from tablename
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900