Solved

Typed Dataset: what happens if the schema changes?

Posted on 2004-08-15
8
437 Views
Last Modified: 2006-11-17
I'm new to C#, and I've just set up a typed Dataset using VS.NET's little wizard.

I was wondering what happens if the schema of the (in this case) SQL Sever table changes?  How does VS.Net handle this?
0
Comment
Question by:gdbjohnson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11804677
it depends on the schema change.

if its a relationship change i.e. a constraint has been changed it may fail completely dependant upon the data it receives
if its a datatype change to a column it may or may not fail depending on if it is changing the intrinsic  .net type being used
if a column is added it will work fine.
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11805890
so how does VS.Net update the dataset to correct potential failures?  Is it as simple as just re-running the "Generate Dataset" wizard?  I'm trying to guage the kinds of complications that may arise with this feature.  

Do you recommend using Typed Datasets?  They seem powerful, but I've had too much experience with fancy features not working well if you do something that MS doesn't expect to not be careful.

G
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 50 total points
ID: 11805931
I personally do not recommend them but then again I work on very large applications (400 tables is a good example) ... I personally use object persistance layers as they provide a higher level of encapsulation/flexibility. Using typed datasets is fine I am sure for smaller applications ... yes you would need to regenerate the dataset to fix the schema changes.

http://dotnetjunkies.com/WebLog/bsblog/archive/2004/05/04/12748.aspx

search around on them and you will find people saying alot of good and bad things about them
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 2

Author Comment

by:gdbjohnson
ID: 11810037
well, this is definately a project of smaller magnitude (development team of 1 :) , so perhaps I will investigate their use.

thanks for your opinion.
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11826380
sorry to bug you, especially since I've accepted your answer, but given your experience I'd like your opinion on one more thing:

do you use DataBinding in your apps?  does it work well?

I asked this in another question, and 2 people responded with yes.  I was wondering what you thought about it.

G
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11826566
As any technology it has its benefits and its drawbacks.

Benefits:
Less code !!
Well tested code
when used with objects pushes a mvc pattern

Drawbacks:
Kind of convoluted to do some more advanced features (i.e. it will do it but it takes some getting used to)
A bit less control over the process

Personally I use databinding mostly to objects (not datasets etc) I am estatic to finally have reasonable support for such. Some of the issues I run into are in dealing with collections and hanving to implement IBindingList on my collections if I want to support various things this is not exactly a trivial process, although much can be done in a base class through reflections. Another spot where I currently have a pain is binding image fields... it is easier to just grab a byte array and push it in as a parameter than it is to setup the parsers/formatters to do it (and less code), from what I have seen 2.0 does a much better job on this though.

Overall though I am quite happy with the databinding model and look forward to the new functionalities being added ... I mean there is nothing worse than code like the following ...

TextBox1.Text = Format(obj.Value1);
TextBox2.Text = Format(obj.Value2);
TextBox3.Text = Format(obj.Value3);
.
.
TextBox229.Text = Format(obj.Value229);

now ... another 229 lines of code to set the data back to the object :)
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11830178
excellent.  
Thanks alot.  I'd raise the points if I could.  :)

I've been working with VB6 for the last 2 years, and have developed a faint sense of loathing for the language and it's 'features' - especially databinding.

Working in a more solid OOP language like C# is a breath of fresh air - and I[m glad that these features are more robust now.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11831712
no worries, points and a dollar will get me a cup of coffee ...

they are getting even better in 2.0 ;) check out the beta.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
"Emulate" TAB key when press Enter Key 3 91
Problem to copy file 14 87
Create a Dropdown list with sub group 10 40
What!!!??? 5 59
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question