471,627 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C# OO concept and SQL Server Table

Hi,

My project is .Net 1.1 C# Windows Form project, and the database server is
SQL Server 2000.
In one of the database's datatable MyTable, the Primary Key is a Join Key
[Name, Number].
Now in my C# Windows form MyForm, it is designed mainly for manipulating the
datatable MyTable.
I am thinking if we apply the OO concept, do we need to have public function
like:

public string[,] GetMyTable(string aName,string aNumber)

Since I am thinking the [Name, Number] will indicate a unique row in the
MyTable in SQL Server.
Also, do I need to build a contsructor for pass value [Name, Number] for
other forms?
Thanks for help.
Jason

Jan 25 '06 #1
2 1163
First of all, why don't u use single primary key instead of using Join
Key (according term u used). U can create it manually or
uniqueidentifier with default value - newid()

Secondly, u can use DataSet or DataTable object when u need pass data
to other forms by overloading constructor or using property.

Hope that help u

Jan 25 '06 #2
Jason Huang wrote:
Hi,

My project is .Net 1.1 C# Windows Form project, and the database server is
SQL Server 2000.
In one of the database's datatable MyTable, the Primary Key is a Join Key
[Name, Number].
Now in my C# Windows form MyForm, it is designed mainly for manipulating the
datatable MyTable.
I am thinking if we apply the OO concept, do we need to have public function
like:

public string[,] GetMyTable(string aName,string aNumber)

Since I am thinking the [Name, Number] will indicate a unique row in the
MyTable in SQL Server.
Also, do I need to build a contsructor for pass value [Name, Number] for
other forms?
Thanks for help.


If you REALLY want to practice good OO, you would use some kind of Data
Access Object pattern. There is was a good couple of articles posted to
code project about this recently.

http://www.codeproject.com/dotnet/ADONETOOP.asp
http://www.codeproject.com/dotnet/AdoNetForOopPart2.asp

It may seem overly complicated at first, but with a reasonably small
amount of code, you can have a true OO model which happens to have a
database underneath.
--
Jay R. Wren
Jan 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by nop90 | last post: by
1 post views Thread by Dick | last post: by
5 posts views Thread by strutsng | last post: by
2 posts views Thread by Howard | last post: by
1 post views Thread by sj | last post: by

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.