Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to select a field by name
Message
From
27/08/2012 19:54:54
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Miscellaneous
Thread ID:
01551564
Message ID:
01551620
Views:
62
Understood, though this is simply an "if...then" form of the switch statement that I'm trying to avoid.

David

>>Okay, this is evidence that I've thought like a VFP programmer for a long time. What I want to do might look something like this:
>>
>>
>>public class MyClass()
>>{ 
>>    DataRow table1;
>>    DataRow table2;
>>
>>    public void AssignRow(DataRow input)
>>    {
>>        tableName = input.Table.TableName; // (could be "table1" or "table2")
>>        &tableName = input; //notice the clever use of VFP syntax...
>>    }
>>}
>>
>>
>>Any way of doing this short of a potentially long select statement?
>>
>>Thanks
>
>
>public class MyClass()
>{ 
>    DataRow table1;
>    DataRow table2;
>
>    public void AssignRow(DataRow input)
>    {
>        tableName = input.Table.TableName; // why tableName doesn't have a type?
>        if(tableName == "table1")
>           table1 = input; 
>        else 
>           table2 = input; 
>    }
>}
>
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Previous
Reply
Map
View

Click here to load this message in the networking platform