|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to change a value inside a data column???If the dcSource.ColumnName == 'Text' then I would like to change the contents of drSource[dcSource.ColumnName]. How would I do this? I know I could use the ToString() method on the drSource[dcSource.ColumnName] to return a value and then use the replace() method on that value. Although I would like to change the contents using an ADO.NET way. Can this be done and how? Thanks in advance. if( "Text" == dcSource.ColumnName.ToString() ) { //somehow find out if a certain string is present in the below and if so then change the contents of the below, then copy value across. drSource[dcSource.ColumnName] = drSource[dcSource.ColumnName] } -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-ado-net/200511/1 "Jon S via DotNetMonster.com" <u2272@uwe> wrote in message news:56c1265750933@uwe...Show quote > Hi all, If I understand you correctly you just change a value like this...> > If the dcSource.ColumnName == 'Text' then I would like to change the > contents > of drSource[dcSource.ColumnName]. How would I do this? I know I could > use > the ToString() method on the drSource[dcSource.ColumnName] to return a > value > and then use the replace() method on that value. Although I would like to > change the contents using an ADO.NET way. Can this be done and how? > Thanks > in advance. > > if( "Text" == dcSource.ColumnName.ToString() ) > { > //somehow find out if a certain string is present in the below > and > if so then change the contents of the below, then copy value across. > drSource[dcSource.ColumnName] = drSource[dcSource.ColumnName] > } > > > -- > Message posted via DotNetMonster.com > drSource[dcSource.ColumnName] = "NewValue"; - However in your code snippet, you're just setting a value to itself. Maybe I dont' understand your end goal. http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-ado-net/200511/1 Hi Mr Ryan
Thanks for replying, it was a simple one and its resolved now. Thanks. -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-ado-net/200511/1 |
|||||||||||||||||||||||