473,372 Members | 1,103 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

FillSchema Doesn't bring SQL Server Default Values

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
Jul 22 '05 #1
1 3245
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
"Lishi Liu [MSFT]" <li****@online.microsoft.com> wrote in message
news:ny**************@TK2MSFTNGXA01.phx.gbl...

If you work on SQL server, you get it by
execute sp_MShelpcolumns
for example:
execute sp_MShelpcolumns 'dbo.Authors', null, 'id', 1

The out put one row are for each column of the table dbo.Authors.
There is a output column "Text", that contain the the default value for
each column of the table(on each row).
Another output column "col_defname", contains the default object binded
for
each column of the table.

Or you can open a table in table designner, see the defaul value or
binding
property.

VSData team, Lishi Liu

--------------------
Reply-To: "Programmer" <se*******@hotmail.com>
From: "Programmer" <se*******@hotmail.com>
Subject: FillSchema Doesn't bring SQL Server Default Values
Date: Thu, 30 Jun 2005 15:04:14 +0300
Keywords: FillSchema , SQL Default Values in FillSchema,FillSchema Doesn't

bring SQL Server Default Values
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
X-RFC2646: Format=Flowed; Original
Message-ID: <eB**************@tk2msftngp13.phx.gbl>
Newsgroups:

microsoft.public.dotnet.framework.sdk,microsoft.pu blic.dotnet.general,micros
oft.public.dotnet.languages.vb,microsoft.public.do tnet.languages.vb.data
NNTP-Posting-Host: 212.114.125.86
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.general:45167

microsoft.public.dotnet.languages.vb:95051
microsoft.public.dotnet.languages.vb.data:2185
microsoft.public.dotnet.framework.sdk:1779
X-Tomcat-NG: microsoft.public.dotnet.languages.vb.data

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

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
1
by: Programmer | last post by:
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...
0
by: Andrea Temporin | last post by:
We are working on a Db Oracle accessed by Oledb. We get connection using MSDAORA.1 provider ad ORACLE 9.2 drivers on the PC. We create datatables associated to the tables on the db, using...
2
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page...
3
by: Aaron | last post by:
Hi, The SqlDataAdapter.FillSchema method will automatically setup things like the primary keys, auto increment, etc based on the settings on the SQL Server. However, if you create a datatable...
1
by: Rich | last post by:
Hello, I want to use a dataAdapter to insert rows into a table on a sql server DB. I understand that the DataAdapter will automatically handle concurrency issues. So first I have to get a table...
16
by: Robert Dufour | last post by:
Here's the class code snippet Imports System.Configuration.ConfigurationManager Public Class Class1 Public _strTestSetting As String Public Sub SetTestsetting()
8
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all I noticed that if Select stmt returns dataset containing two tables, executing FillShema only populates schema info for first table only. Simple test: (.NET 2.0) .... string strSQL...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.