Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If(ds.Table[0].Rows[6]!== Null)
{
lblauthorititesname16.Text = ds.Tables[0].Rows[6]["authoritites_Name"].ToString();
lblauthorititesdesig17.Text = ds.Tables[0].Rows[6]["authoritites_Designation"].ToString();
lblauthorititescontact18.Text = ds.Tables[0].Rows[6]["authoritites_Contact"].ToString();
}
If(ds.Table[0].Rows[6]!== Null)
{
lblauthorititesname19.Text = ds.Tables[0].Rows[7]["authoritites_Name"].ToString();
lblauthorititesdesig20.Text = ds.Tables[0].Rows[7]["authoritites_Designation"].ToString();
lblauthorititescontact21.Text = ds.Tables[0].Rows[7]["authoritites_Contact"].ToString();
}

What I have tried:

Please help me how to check i want to use ds of row value then goes in to if condition
Posted
Updated 27-Mar-17 19:15pm

You can try this condition :
if (DataSet.Tables(0).Rows(0).Item["FieldName"] == DBNull.Value){
//null condition 
}
else{
//not null condition 
}
 
Share this answer
 
Comments
Member 12183079 28-Mar-17 2:12am    
thank you
if(ds.Tables[0].Rows.Count>=7){ // ensure that row 6 exists // zero based index 
            string[] columnsToCheck = new string[]{"authoritites_Name","authoritites_Designation","authoritites_Contact"};
            bool isAllColumnsNull =  columnsToCheck.All(k=> string.IsNullOrEmpty( ds.Tables[0].Rows[6][k]+""));
            if(!isAllColumnsNull){
                // your code.
            }
        }
 
Share this answer
 
Comments
Member 12183079 28-Mar-17 2:12am    
thank you
Karthik_Mahalingam 28-Mar-17 8:48am    
welcome

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