FillSchema Doesn't bring SQL Server Default Values

P

Programmer

Hi All

Here is my problem

I'm using a SQLDataAdapter and DataSet

I use the method FillSchema(myDataset, SchemaType.Source)
The problem is that when i Check the default Values of the Dataset
i can see that the DefaultValue of the columns is system.dbnull!!!!
But in SQL Server i have put as default values in a bigint field the '0' and
the field is also required

The Dataset is bound to a Datagrid and it's totaly disconected from the
server (Custom Control)
So because i handle the event of new row i must perform the AddRow at my
own.
I have capture the event and handle it for many reasons. And i can't change
it.
this is the code
Dim nr As DataRow = myDataset.Tables(0).NewRow
dsData.Tables(0).Rows.Add(nr)

Then i have the crash!. And the reason is that no Default Values exists from
the FillSchema call

Where is my default value??????????????????
How can i get them from the SQL????

Thank you in advance.

Kind Regards
Dimitris
 
P

Programmer

I know that i can get the default values of columns on syscolumns and other
system tables.

IN .NET In DataSet to be exact. Fill Schema should bring the default.
Now I'm just making 2 steps and disconect from the server.
1. FillScehama(MyDataset, SchemaType.Source)
2. Fill(MyDataset.Tables(0))

And the only proposion is to get a DataReader for example loon in it so i
can get the default values?
I have thowht that. But I don't like it.

Isn't any implimentetion in .NET to do it without running a new select
statement??
Does finally the FillScehama has a bug?



Thank you for your reply.
Kind Regards
Dimitris
 

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