Click here to Skip to main content
15,915,324 members
Home / Discussions / Database
   

Database

 
QuestionGenerating the INSERT script Pin
Brendan Vogt3-Oct-06 1:28
Brendan Vogt3-Oct-06 1:28 
AnswerRe: Generating the INSERT script Pin
Colin Angus Mackay3-Oct-06 5:28
Colin Angus Mackay3-Oct-06 5:28 
GeneralRe: Generating the INSERT script Pin
Brendan Vogt3-Oct-06 20:56
Brendan Vogt3-Oct-06 20:56 
GeneralRe: Generating the INSERT script Pin
Colin Angus Mackay3-Oct-06 21:37
Colin Angus Mackay3-Oct-06 21:37 
GeneralRe: Generating the INSERT script Pin
Brendan Vogt3-Oct-06 21:45
Brendan Vogt3-Oct-06 21:45 
GeneralRe: Generating the INSERT script Pin
Brendan Vogt4-Oct-06 21:23
Brendan Vogt4-Oct-06 21:23 
GeneralRe: Generating the INSERT script Pin
Colin Angus Mackay4-Oct-06 21:39
Colin Angus Mackay4-Oct-06 21:39 
QuestionADO.Net Problem getting schema information: AllowDBNull vs. IsNullable Pin
JSchumann3-Oct-06 1:22
JSchumann3-Oct-06 1:22 
Hello,

I'm trying to gather the schema information for a tables columns using ADO.Net with OleDb (an Access Database) and Sql (a SQL Server database) and found some problems:

For OleDb/Access:
method 1 to get the MetaData Collections
OleDbConnection currentconnection = ...;<br />
DataTable schema = currentConnection.GetSchema("COLUMNS");


method 2 to get the schema for the commands result:
OleDbCommand cmd = ...;<br />
OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);<br />
DataTable schema = reader.GetSchemaTable();


Both give me the correct list of columns, but the values for IsNullable (from method 1) and AllowDBNull (method 2) differ!?

I'm using the Northwind database for example purposes and for one table (Order Details) I get IsNullable=true for the first foreign key and IsNullable=false for the second foreign key.
I also get IsNullable=false for the other three columns that have a Column_Default set.
Method 2 seems to give the correct values: AllowDBNull=false for the two foreign keys and AllowDBNull=true for the default-value-columns.

In another table (Categories) method 1 returns IsNullable=false for a VarChar column and method 2 returns AllowDBNull=true for the same column, while this time I think method 1 gives the correct answer because SQL Server says IsNullable=false and AllowDBNull=false for this column.

How comes that? Am I missing a difference in this two values? Because I saw many websites using them as synonyms, e.g. http://www.koders.com/csharp/fid74A751F1A6F8ACEB258469216B7C263679DAD88A.aspx

The other problem is when using the SQL Server (again using northwind database). This time both methods return identical values, if IsNullable=false then AllowDBNull=false too.
But: It returns AllowDBNull=false for default-value-columns too? How can i then do an Insert without setting these fields for using the default values?

Sorry for this long text, I'm looking forward for help,
regards J.Schumann
QuestionRe: ADO.Net Problem getting schema information: AllowDBNull vs. IsNullable Pin
JSchumann7-Oct-06 0:32
JSchumann7-Oct-06 0:32 
QuestionEasy, easy select question [modified] Pin
Vodstok2-Oct-06 6:48
Vodstok2-Oct-06 6:48 
AnswerRe: Easy, easy select question Pin
Edbert P2-Oct-06 20:26
Edbert P2-Oct-06 20:26 
QuestionTable clone on same database. Pin
theJazzyBrain2-Oct-06 2:46
theJazzyBrain2-Oct-06 2:46 
AnswerRe: Table clone on same database. Pin
Colin Angus Mackay2-Oct-06 5:16
Colin Angus Mackay2-Oct-06 5:16 
QuestionPlease assist to solve this problem Pin
pubududilena2-Oct-06 1:35
pubududilena2-Oct-06 1:35 
AnswerRe: Please assist to solve this problem Pin
Michael Potter2-Oct-06 4:37
Michael Potter2-Oct-06 4:37 
GeneralRe: Please assist to solve this problem Pin
pubududilena3-Oct-06 19:47
pubududilena3-Oct-06 19:47 
GeneralRe: Please assist to solve this problem Pin
Michael Potter4-Oct-06 4:00
Michael Potter4-Oct-06 4:00 
QuestionOrdering a linked list Pin
Rob Philpott1-Oct-06 23:34
Rob Philpott1-Oct-06 23:34 
AnswerRe: Ordering a linked list Pin
Colin Angus Mackay2-Oct-06 0:41
Colin Angus Mackay2-Oct-06 0:41 
GeneralRe: Ordering a linked list Pin
Rob Philpott2-Oct-06 1:11
Rob Philpott2-Oct-06 1:11 
GeneralRe: Ordering a linked list Pin
Colin Angus Mackay2-Oct-06 2:01
Colin Angus Mackay2-Oct-06 2:01 
GeneralRe: Ordering a linked list Pin
Rob Philpott2-Oct-06 3:01
Rob Philpott2-Oct-06 3:01 
GeneralRe: Ordering a linked list Pin
Colin Angus Mackay2-Oct-06 8:04
Colin Angus Mackay2-Oct-06 8:04 
GeneralRe: Ordering a linked list Pin
Colin Angus Mackay2-Oct-06 8:07
Colin Angus Mackay2-Oct-06 8:07 
QuestionLargest Data Typein SQL Server Pin
King Shez1-Oct-06 21:08
King Shez1-Oct-06 21:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.