Link to home
Start Free TrialLog in
Avatar of gdbjohnson
gdbjohnson

asked on

Typed Dataset: what happens if the schema changes?

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?
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

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.
Avatar of gdbjohnson
gdbjohnson

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well, this is definately a project of smaller magnitude (development team of 1 :) , so perhaps I will investigate their use.

thanks for your opinion.
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
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 :)
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.
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.