Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
if (Convert.ToInt32(dsavailablity.Tables[0].Rows.Count) > Convert.ToInt32(dsavailablity.Tables[0].Rows[i]))

While i checking this condition i am getting this error "Unable to cast object of type 'System.Data.DataRow' to type 'System.IConvertible'." pls provide me solution for that.
Posted

1 solution

You can't convert a whole row to an int! It doesn't work because a row contains zero or more values - and it can't convert more than one value to an int.
Try:
C#
Convert.ToInt32(dsavailablity.Tables[0].Rows[i].Cells[0])
 
Share this answer
 

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