473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Common string class.

Okay, I am sure this question has been asked here before, but to all
of the Object Oriented Guru's, please shed some light on a simple
question. What is the best practice for creating a common text
object? For example, I have a table named "User" that has a column
named FIRST_NAME; I would like to access the string value of the
column name using something like:

Constants.UserTable.FirstName or UserTable.ColumnNames.FirstName

where the "FirstName" property of these examples would be set/equal to
the value of "FIRST_NAME".

Quick final example, instead of using:

string firstName = row["FIRST_NAME"].ToString();

I would like to use something like:

string firstName = row[UserTable.ColumnNames.FirstName].ToString();

Is it better to create nested classes (which I use now), or is there a
better OOP way to accompish this task? Any help is greatly
appreciated!

Thank you,

Todd
Nov 16 '05 #1
1 1247
sounds overly complicated.....

are these tables, rows and columns objects instances of the .Net framework
classes in the System.Data namespace, if so you can do

string firstValue = row[0].ToString();
string secondValue = row[1].ToString();

etc...

what is wrong with that?

HTH

Ollie


"Todd Clarkston" <co********@yahoo.com> wrote in message
news:b5**************************@posting.google.c om...
Okay, I am sure this question has been asked here before, but to all
of the Object Oriented Guru's, please shed some light on a simple
question. What is the best practice for creating a common text
object? For example, I have a table named "User" that has a column
named FIRST_NAME; I would like to access the string value of the
column name using something like:

Constants.UserTable.FirstName or UserTable.ColumnNames.FirstName

where the "FirstName" property of these examples would be set/equal to
the value of "FIRST_NAME".

Quick final example, instead of using:

string firstName = row["FIRST_NAME"].ToString();

I would like to use something like:

string firstName = row[UserTable.ColumnNames.FirstName].ToString();

Is it better to create nested classes (which I use now), or is there a
better OOP way to accompish this task? Any help is greatly
appreciated!

Thank you,

Todd

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: D Witherspoon | last post by:
What is the accepted method of creating a data class or business rules object class with properties that will allow the returning of null values? For example... I have a class named CResults with...
6
by: Busin | last post by:
Classes B, C, D and E are derived from base class A. A* CreateB(); A* CreateC(); A* CreateD(); A* CreateE(); class X { public:
3
by: Pete via DotNetMonster.com | last post by:
Hi, I've created a class that contains a common function. When I try to invoke the function or method, I get the error: BC30451: Name 'dataClass' is not declared. The class file dataClass.vb...
5
by: wrecker | last post by:
Hi all, I have a few common methods that I need to use at different points in my web application. I'm wondering where the best place would be to put these? I think that I have three options. ...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
3
JoeMac3313
by: JoeMac3313 | last post by:
My Assignment was to compare two lists and print out the number of elments that are same. It is supposed to look like this Week 7 Homework The number of common elements is: 3 The number of...
15
by: Juha Nieminen | last post by:
I'm sure this is not a new idea, but I have never heard about it before. I'm wondering if this could work: Assume that you have a common base class and a bunch of classes derived from it, and...
9
by: Peri | last post by:
Dear All, I have written a common array class which has insert, search and other functions. For Example (Code in VB.NET): ' Client Class Public Class Client Public ClientCode As String ...
6
by: Arial | last post by:
I have more classes with several common properties. e.g. class A { string Class_A_Prop1{get; set;} string Class_A_Prop2{get; set;} string CommonProp1{get; set;} // common to all classes
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.