473,396 Members | 1,936 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,396 software developers and data experts.

Typed Datasets

Hi,
I have a problem whereby I have one form dealing with one of two
typed datasets with almost all the same column names except two, depenind on
which option the user selects.

at the moment I have if statements like the following that set the value of
form fields etc, depeninding on the selected value

if (selectedtab = "Agency")
{
txtfield.Name = AgencyDataset.AgencyTable[currentindex].AgencyName ;
}else if (selectedbat = "Advertiser") then
{
txtfield.Name =
AdvertiserDataset.AdvertiserTable[currentindex].AdvertiserName;
}
do you know of a smarter way of doing this so I don't have to continually do
if statements to determine which dataset to use and also to avoid getting
type casting errors.
Thanx in advance
Robert


Mar 11 '08 #1
2 1163
"Robert Smith" <Ro*********@discussions.microsoft.comwrote in message
news:EE**********************************@microsof t.com...
Thanks Roger,
Will that not cause issues when updating the dataset when
the name of the dataset column does not match the column in the underlying
database name.

I tried using select AgencyName as Name etc, and then updating the dataset
but haven't changed the actual dataset column names;

I was just thinking that if your tables are already 1 column name from being
of identical schema as it is, and they hold the same basic information: a
name, you may as well rename the columns to simplify data access.

Preferably (in this case), I would combine both the tables into one standard
table (like ContactInfo for example) and add separate tables for Agencies
and Advertisers that have a foreign key relationship with ContactInfo. This
makes much more sense to me, but I have limited knowledge about your system
to go on.

On the other hand, if this database is already in use these changes will
certainly break other client applications.

The good news is you can get around this without breaking existing tools by
leaving them as they are and adding a identical column alias to each table's
....Name column.

You just need to think about what you're trying to do now and who (if
anyone) is already relying on this database. There are many ways to
simplify your Dataset dilemma, the route you take will be determined by the
issues listed above, and many others.

Just think it through (and _always_ backup before you go wild with schema
changes:) )
--
Roger Frost
"Logic Is Syntax Independent"

Mar 11 '08 #2
Thanks Roger,
Actually the Identifer key also have different names. One is
AgencyId and the other is AdvertiserId. Does your theory still hold true
knowing this information.
"Roger Frost" wrote:
"Robert Smith" <Ro*********@discussions.microsoft.comwrote in message
news:EE**********************************@microsof t.com...
Thanks Roger,
Will that not cause issues when updating the dataset when
the name of the dataset column does not match the column in the underlying
database name.

I tried using select AgencyName as Name etc, and then updating the dataset
but haven't changed the actual dataset column names;

I was just thinking that if your tables are already 1 column name from being
of identical schema as it is, and they hold the same basic information: a
name, you may as well rename the columns to simplify data access.

Preferably (in this case), I would combine both the tables into one standard
table (like ContactInfo for example) and add separate tables for Agencies
and Advertisers that have a foreign key relationship with ContactInfo. This
makes much more sense to me, but I have limited knowledge about your system
to go on.

On the other hand, if this database is already in use these changes will
certainly break other client applications.

The good news is you can get around this without breaking existing tools by
leaving them as they are and adding a identical column alias to each table's
...Name column.

You just need to think about what you're trying to do now and who (if
anyone) is already relying on this database. There are many ways to
simplify your Dataset dilemma, the route you take will be determined by the
issues listed above, and many others.

Just think it through (and _always_ backup before you go wild with schema
changes:) )
--
Roger Frost
"Logic Is Syntax Independent"
Mar 11 '08 #3

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

Similar topics

0
by: Natehop | last post by:
I've been attempting to design an n-tiered framework leveraging .NET's strongly typed Dataset. My Framework will serve as the foundation to several client apps from Windows applications to web...
0
by: Bj?rn Mor?n | last post by:
I am consuming a web service that returns arrays of classes which can contain other classes (a hierarchy of data). Is there a simple way to move the data into a typed DataSet without writing too...
7
by: Tim Smith | last post by:
Hi, Is it possible to create a progam to mimic the following action a) drag oledbadapter to form1.cs b) select my oracle ole connection c) enter 'select * from mytable' d) create adapter for...
3
by: Rob Thomas | last post by:
Hi, I've been tasked to come up with a new architecture for a large application at one of my customer's sites. In the past, I have developed multi-tier applications whereby the business...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
3
by: Mike | last post by:
Hi, I'm delevloping a webservice that returns typed datasets with visual studio 2005. The problem is, that the typed data set in the client app is not the same as in the webservice. If I change...
21
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but...
4
by: newtonwong | last post by:
I have a web reference WSDL, but it doesn't really create an XSD. I'm trying to generate datasets from the WSDL file but not sure how to do so. I successfully created the proxy class, but the...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.