Re: typed datasets and default values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You could always extend the MSDataSetGenerator. You would have to call
to the base generator, and then parse the code with CodeDom. Then, you
would have to connect to SQL Server to get the default values for the
columns in your data set, and adjust those.

You shouldn't need a wrapper class around the dataset. Rather, have a
method that takes the data set and takes a connection (or uses one it
already has).

Then, what you do is select the default values from the database for the
columns in the tables in the dataset. Once you have these, you can cache
the values for your table, and then prevent the excessive database hits.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

<tg.foobar@xxxxxxxxx> wrote in message
news:1134070608.001674.262350@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> my setup:
>
> visual studio 2005
> sql server 2000
>
> i'm using a dataset (used to be called typed dataset in 2003), where i
> use the MSDataSetGenerator to create a class for me based on the scheme
> of my SQL server. This schema doesn't include the default values that
> are defined in the SQL server. It's setting all the default values to
> NULL. is thre an easy way to get around this? for example, i have a
> "quantity" (byte) column in the "orders" table with a default value of
> 5, i would want to see:
>
> mydataset._orders.columns("quantity").quantity.defaultvalue == 5
>
> right now that value is DBNULL.
>
> Yes, i know i can go into the schema and change the default value
> there, but if i change hte database and need to regenerate the data set
> then i need to change all the default values again. Yes, i know i can
> make a wrapper class around the dataset (i actually have one already)
> and put in a function that sets all the default values to the ones i
> want at creation, but i have lots of tables and lots of columns and
> that would be quite tedious. It seems like there should be an easier
> way.
>


.



Relevant Pages

  • Re: Unique in-depth problem
    ... Standard date libraries don't work. ... Precompute all the dates and put them in a database (file, SQL server, ... a huge data set, yet manage to retrieve and show only the interesting ...
    (comp.lang.perl.misc)
  • Re: International Access version problem
    ... > data set is correct or not. ... > formatting is used at form level that causes the problem. ... For 2 clients, however, they have a Danish Access installed and ... how do we get SQL server ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Please help quick statement check
    ... these two statements would get a complete data set. ... records which also have a recording match, and then i want to get all ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: database design for fast client updates
    ... program to read and display updates to the data set. ... I assume that these updates are not performed by your client program, ... Rather than using a datetime column, you could use a timestamp column. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)