473,832 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(stri ng 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 1229
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
uniqueidentifie r 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(stri ng 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2340
by: nop90 | last post by:
Proof of concept: Currently I have a web hosting service and it does support php. Can the following be done in php? Explanations or examples would be appreciated. Create 2 applications, app-1 and app-2 app-1 loops continuosly. Every 1 second the application writes the time of day to a file.
1
3884
by: Dick | last post by:
Before going in to details i like to understand more about concept and design of this database. Most books go directly in to details. Please, can a current admistrator gife me information on this? Thanks in advance, Dick vd Spek email: ds@dds.nl
5
1368
by: strutsng | last post by:
I want to clarify the concept of submitting the form to the web server. PHP is just an example here, it applies to any web programming languages. On page1.php, <form name="myform" action="otherpage.php" method="post"> means 2 steps here: 1) submit the form called "myform" on page1.php to the web server using HTTP POST method.
7
2953
by: srinivas | last post by:
Hi, I am a asp programmer.I am displaying the db records in the html pages in a web page.I have 500 columns and 1000 rows in that html table.Here i am planning to implement the "MS-Excel Freeze Panes" concept.How to implement this concept in a web page.If any body have the code or good resource please send me. Thanks in Advance
2
1129
by: Howard | last post by:
I need to write a web page that outputs a table from database. ( i want to write my own code, don't want to use the built-in control) I came up with two ways of doing this (i use c# 2.0) 1. pesudo code sqlstringTable = "select category_name from table1" execute(sqlstringTable) while(read)
1
1191
by: sj | last post by:
I need to write an application to perform Quotations, and confrimed Quotations information can later extracted and print a Delivery Order, and finally an Invoice. Note that, ammendments maybe made at different stages (meaning quantity may varies, further discount exercised during invoicing, etc). What is best way to build this type of task? Do I keep all these document information in 1 table or is it better for me to maintain the 3 or...
1
1433
by: John | last post by:
AJAX is a rich client-side technology that makes the web pages more interactive. In practice, the same AJAX client-side code should be unchanged, regardless of what server-side web technologies we use. I guess this is same concept as traditional front-end plain html code that can work with different server-side web technologies for back-end processing. Similarly, AJAX should be server-side independent concept, is that correct? But if this...
0
830
by: Raj | last post by:
Hi All.., I have a VB.Net Windows Application.. I need to Run this Exe From Some Other System(Client) and I need to Upload some specified files to the Server System.. Now my doubts are.. 1) Is client-Server concept is Possible in Windows Applications..
2
5643
by: suganthy | last post by:
Hi, Can any one tell the merits and demerits of table concept in integrating a html layout when compared with DIV concept Thanks
0
9795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10540
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4421
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3077
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.