can I use '+=' in a datarow
-
hi I have datarow which contains an int column I want to increase the value by 1: (int)row[0][0] += 1 // the first column is an int field but when I do this I get an error: "The left-hand side of an assignment must be a variable, property or indexer" is there a way to do this?
-
hi I have datarow which contains an int column I want to increase the value by 1: (int)row[0][0] += 1 // the first column is an int field but when I do this I get an error: "The left-hand side of an assignment must be a variable, property or indexer" is there a way to do this?
What database, what language, are you using the CLR. If you are using SQL then you need to learn the language, it is not C#. Thats why they invented linq - to get you poor sods a language you knew.
Never underestimate the power of human stupidity RAH
-
hi I have datarow which contains an int column I want to increase the value by 1: (int)row[0][0] += 1 // the first column is an int field but when I do this I get an error: "The left-hand side of an assignment must be a variable, property or indexer" is there a way to do this?
Maverickcool wrote:
but when I do this I get an error: "The left-hand side of an assignment must be a variable, property or indexer"
Don't you want to understand why you get this error? You have cast the left side to an int meaning the left side is no longer the indexer. You could probably write
row[0][0] = ((int)row[0][0]) + 1;
But, since I don't use DataSets it may or may not work.*Developer Day Scotland - Free community conference Delegate Registration Open
-
Maverickcool wrote:
but when I do this I get an error: "The left-hand side of an assignment must be a variable, property or indexer"
Don't you want to understand why you get this error? You have cast the left side to an int meaning the left side is no longer the indexer. You could probably write
row[0][0] = ((int)row[0][0]) + 1;
But, since I don't use DataSets it may or may not work.*Developer Day Scotland - Free community conference Delegate Registration Open
Thanks Colin !