Home All Groups Group Topic Archive Search About

Command Window error when attempting to modify variable

Author
3 Apr 2007 9:54 PM
luke_airig
Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework  1.1 Version 1.1.4322

I am trying to modify the value of a variable in the Command Window
(immediate mode) but I am getting an error.

Here is the code snippet:

U_Appr_InfoDS.U_APPR_INFODataTable dt =
da.GetAllAppraiserInfo(this.LoanNumber);
if (dt.Rows.Count > 0)        //My breakpoint is set here...

Here are the contents of the Command Window:

        dt.Rows.Count=1
        error: cannot assign '1' into 'dt.Rows.Count'

Can anyone give some insight to this problem or recommend a solution?

TIA

Luke

Author
3 Apr 2007 11:29 PM
Peter Duniho
On Tue, 03 Apr 2007 14:54:49 -0700, <luke_ai***@hotmail.com> wrote:

> [...]
> Here are the contents of the Command Window:
>
>         dt.Rows.Count=3D1
>         error: cannot assign '1' into 'dt.Rows.Count'
>
> Can anyone give some insight to this problem or recommend a solution?

You do not offer enough information for anyone to know for sure, since y=
ou  =

didn't include anything that would tell us for sure what the type of "dt=
"  =

is, what type its Rows property is, or how the Count property is to be  =

used.

However, if it's anything at all like other classes, the Count property =
is  =

read-only and you cannot assign anything to it.  If you want to change t=
he  =

number of elements in the Rows collection, you need to do so by adding o=
r  =

removing items.  It's certainly possible to design a class that would do=
  =

that for you when you assign a value to the Count property, but it would=
  =

be a bad idea and I hope there aren't any .NET classes that do that.

Pete

AddThis Social Bookmark Button