DataView or DataTable question

  • Thread starter Thread starter DBC User
  • Start date Start date
D

DBC User

I have a dataset with one table and I want to change one coumn value
to a fixed constant. Is it possible to do it without iterating through
each row?
Thanks.
 
One thing you could try is to set the Expression property on that
column to be the constant.

datatable1.Columns["Col2"].Expression = "1888.1";

=====================
Clay Burch
Syncfusion, Inc.
 
One thing you could try is to set the Expression property on that
column to be the constant.

datatable1.Columns["Col2"].Expression = "1888.1";

=====================
Clay Burch
Syncfusion, Inc.

This is what I am trying to replace to a single command

foreach (DataRow dr in rsDS.Tables[0].Rows)
{
dr[DataBaseNames.LocationName] = "1888.1";
}

If I use Expression I get an error message "Missing operand after
'Site' operator.

Thanks.
 
Why is there a period in this
DataBaseNames.LocationName
?


foreach (DataRow dr in rsDS.Tables[0].Rows)
{
if (null!= dr["mycolumnname"])
{
dr["mycolumnname"] = "1888.1";
}
}




with non strongly typed datasets, you need to always check for null
..........


DBC User said:
One thing you could try is to set the Expression property on that
column to be the constant.

datatable1.Columns["Col2"].Expression = "1888.1";

=====================
Clay Burch
Syncfusion, Inc.

This is what I am trying to replace to a single command

foreach (DataRow dr in rsDS.Tables[0].Rows)
{
dr[DataBaseNames.LocationName] = "1888.1";
}

If I use Expression I get an error message "Missing operand after
'Site' operator.

Thanks.
 
Is this the code you tried to set the Expression property of your
column?


rsDS.Tables[0].Columns[DataBaseNames.LocationName].Expression =
"1888.1";

====================
Clay Burch
Syncfusion, Inc.
 
Is this the code you tried to set the Expression property of your
column?

rsDS.Tables[0].Columns[DataBaseNames.LocationName].Expression =
"1888.1";

====================
Clay Burch
Syncfusion, Inc.

Yes thats what I am trying and I am getting the site error I posted
earlier.
Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top