473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(myDa taset, SchemaType.Sour ce)
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.Table s(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 3272
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(MyD ataset, SchemaType.Sour ce)
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******** ******@TK2MSFTN GXA01.phx.gbl.. .

If you work on SQL server, you get it by
execute sp_MShelpcolumn s
for example:
execute sp_MShelpcolumn s '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_defnam e", 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*******@hotm ail.com>
From: "Programmer " <se*******@hotm ail.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,Fill Schema 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.publi c.dotnet.framew ork.sdk,microso ft.public.dotne t.general,micro s
oft.public.dotn et.languages.vb ,microsoft.publ ic.dotnet.langu ages.vb.data
NNTP-Posting-Host: 212.114.125.86
Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.genera l:45167

microsoft.publi c.dotnet.langua ges.vb:95051
microsoft.publi c.dotnet.langua ges.vb.data:218 5
microsoft.publi c.dotnet.framew ork.sdk:1779
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb.data

Hi All

Here is my problem

I'm using a SQLDataAdapter and DataSet

I use the method FillSchema(myDa taset, SchemaType.Sour ce)
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.Table s(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
5480
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; DataBinder.Eval(Container.DataItem,"StoreEmail") &amp; "&amp;Subject=" &amp; DataBinder.Eval(Container.DataItem,"ProductName") ....
1
2055
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 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
0
1279
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 FillSchema. Some tables don't include primary key, even if they have the correct structure on the db. The datatables without primary key are few. The...
2
399
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 that gets redirected to, I've swapped in a simple page for testing that reads the session variables and displays their values.
3
5197
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 using the SQL statement that joins together data from multiple data tables, then FillSchema does not work (as much? at all??). For example, if I use...
1
5209
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 to insert a row into. I have been doing this: da.SelectCommand = New SqlCommand("Select * from tbl1", conn) da.FillSchema(ds,...
16
1758
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
5148
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 = "Select * from tableA select * from tableB" OleDbConnection cn = new OleDbConnection(strConnection);
39
5829
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 ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.