DataSet, new row and default values ?

P

PL

When I add a new row to a DataSet that was filled with info
from a database the new row does not get the default values
defined in SQL Server, how do I accomplish this seemingly
simple task ?

I don't want to have to fill in the default values in the row first,
I want it to understand the defaults set in the database and
fill it automatically as you would expect it to.

Thank you
PL.
 
C

Cor Ligthert

PL

Can you explain more what you mean with "what mean with fill it automaticly
as you would expect", because I know a method, however don't know if that is
the metohd as you expect?

Cor
 
P

PL

In my table in SQL Server I have defaults set for the columns, I fill a
dataset
with info from this table, then I use the NewRow method on the DataTable,
I expect this new row to contain the default values I defined in SQL Server
but it doesn't.

I could set the defaults in the code but this seems silly since I already
have them
defined in SQL Server.

Any tips appreciated.

PL.
 
C

Cor Ligthert

PL,

Why are you expecting that in, other words, it can in my opinion be very
anoying when you get default values when you want null values and can not
control that.

I did not see any function to set that off, so it looks obvious for me that
you have to set it on.

Cor
 
P

PL

Why wouldnt I expect that ?? If I insert values using an insert statement
i certainly get default values, now I just get null values everywhere when
I add the row later.

I really see no use for what you are saying but if you don't have defaults
defined in the db you would get null values wouldn't you ?

Of course I should get the defined default values when I use the NewRow
on the fking table.

Patrik.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top