Click here to Skip to main content
15,905,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i having a data table which contains columns and rows..but there is no values on that fields..
in that data table some cell contains datas and some contains not.
how can i check a particular cell containing values or not .
Posted
Updated 21-May-13 23:19pm
v2
Comments
Mayur Panchal 22-May-13 4:59am    
field means ? a particular cell or whole column ?
geo thomas 22-May-13 5:03am    
paricular cell

1 solution

1) Datatable[^] object
You need to check for DBNull.Value[^].

2) database
Use COALESCE (T-SQL)[^] function to replace NULL value with ownvalue:
SQL
SELECT COALESCE(numericcolumn,0) AS numericcolumn, COALESCE(textcolumn,"empty") AS textcolumn
FROM database
 
Share this answer
 
v2
Comments
geo thomas 22-May-13 5:06am    
how to check wether aparticular cell contain datas or not?
Maciej Los 22-May-13 5:08am    
Follo the above link. At the end of page you'll find an example.
geo thomas 22-May-13 5:15am    
its not what i am lookin for..
am having a data table in sql server 2005.
on a particular row some columesw doent have any datas..
how can i check that cell contain values or not.

string a = "select Break1_Start,Break1_End,Break2_Start,Break2_End,Break3_Start,Break3_End from Attendance_Register where Employee_ID='" + da.remEMP(ei) + "' and Date='"+ d +"' ";
dt = da.getdetails(a);
// dt is datatable obj
//getdetails() which is used to get data from database
Maciej Los 22-May-13 5:34am    
See my answer after update ;)
geo thomas 22-May-13 5:52am    
srry..this is not what i am looking for..

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