Reputation: 35268
I can't convert ds.Tables[1].Rows[0].ToString()
to an int.
ds.Tables[1].Rows[0] = 100;
Gives an error can't convert.
Upvotes: 0
Views: 19087
Reputation: 5456
ds.Tables[1].Rows[0] returns a DataRow. You need to indicate the column that you want to assign the value:
ds.Tables[1].Rows[0]["Your column name"] = value;
Upvotes: 3
Reputation: 4896
Are you missing the column? ds.Tables[1].Rows[0][column] = value;
Upvotes: 1
Reputation: 15754
string test = Convert.Int32(ds.Tables[0].Rows[0]["YourIntegerColumn"].ToString())
If your column isnt an integer, then it's not gonna work, so you'll probly want to check if the column is null, then check if its parsable to an int using Int.TryParse
Upvotes: 3