Click here to Skip to main content
15,891,253 members
Home / Discussions / Database
   

Database

 
Questionmdb file in vs2005 support UTF8 Pin
hamidaman25-Dec-06 11:41
hamidaman25-Dec-06 11:41 
QuestionAssiging a Dataset to GridView Pin
rahul_spi25-Dec-06 8:18
rahul_spi25-Dec-06 8:18 
AnswerRe: Assiging a Dataset to GridView Pin
PavanPareta25-Dec-06 17:22
PavanPareta25-Dec-06 17:22 
QuestionHow to connect the POstgreSQL 8.1.4 with Borland Developer Studio 2006 (Delphi.NET) Pin
Dotnetfish25-Dec-06 5:29
Dotnetfish25-Dec-06 5:29 
AnswerRe: How to connect the POstgreSQL 8.1.4 with Borland Developer Studio 2006 (Delphi.NET) Pin
Keith Malwitz25-Dec-06 17:40
Keith Malwitz25-Dec-06 17:40 
Questionhow to select multiple data from a single DataSet. Pin
PavanPareta25-Dec-06 1:34
PavanPareta25-Dec-06 1:34 
QuestionNOT NULL + DefaultValue column in DataGridView Pin
El'Cachubrey24-Dec-06 23:37
El'Cachubrey24-Dec-06 23:37 
AnswerRe: NOT NULL + DefaultValue column in DataGridView Pin
Uri Lavi26-Dec-06 8:48
Uri Lavi26-Dec-06 8:48 
Actually this is a very good question.
I have assumed that you used typed dataset in your code (that is bounded to the DataGridView).
* The nature of the ADO.NET is a disconnected way of work. Therefore I thought first that we need to define the default property in the DS. When the value of a DateTime column in the DataGridView and the underline DS isn't supplied it is assigned with its default value. So I have tried to accomplish this solution by defining a default value for the DateTime column in the DS's schema. After reading W3C and MSDN definitions of the DateTime constants I have added the following to the schema:
default="2006-01-01T00:00:00"
but surprise, surprise:
I have got the following statement (which actually states that the DS cannot be generated):
"Failed to generate code. Invalid Primitive Type: System.DateTime. Only CLS compliant primitive types can be used. Consider using CodeObjectCreateExpression."
Somehow it seems to be a bug, or maybe the DateTime type should be declared different in the schema when using defaults ??? (Does anybody know something about it ???)
After searching the web a while I have found that
urn:schemas-microsoft-com:xml-msprop can be used. In nutshell it can be used to access the DS's columns that are DBNull.
So this is how the schema looks like now:
<xs:schema 
...
xmlns:codegen="urn:schemas-microsoft-com:xml-msprop"
...
>
...
<xs:element name="d" type="xs:dateTime" codegen:nullValue="2006-01-01T00:00:00" minOccurs="0" />
...

But this isn't the end! In order to actually pass the default value to the DB we should assign this value to the desired row by providing the RowChanged event, like follows:
<br />
...<br />
tds.t.tRowChanged += new tRowChangeEventHandler(t_tRowChanged);<br />
...<br />
<br />
private void t_tRowChanged<br />
(object sender, TDS.tRowChangeEvent e)<br />
 {<br />
  if(e.Action == DataRowAction.Add)<br />
  {<br />
   e.Row.d = e.Row.d;<br />
  }<br />
}<br />

Brrrr... this is a very ugly solution.
* Another way to solve this problem is to avoid to insert values that are NULLs (or DBNulls) i.e. when the values are nulls generate insert sql statement that just omits those values. When omiting the null values the default values of the DB will be applied.

Uri

GeneralRe: NOT NULL + DefaultValue column in DataGridView Pin
El'Cachubrey26-Dec-06 21:19
El'Cachubrey26-Dec-06 21:19 
GeneralRe: NOT NULL + DefaultValue column in DataGridView Pin
Uri Lavi27-Dec-06 0:59
Uri Lavi27-Dec-06 0:59 
GeneralRe: NOT NULL + DefaultValue column in DataGridView Pin
El'Cachubrey27-Dec-06 4:08
El'Cachubrey27-Dec-06 4:08 
QuestionSelect satatment Pin
wmostafaw23-Dec-06 21:31
wmostafaw23-Dec-06 21:31 
AnswerRe: Select satatment Pin
rp_suman23-Dec-06 22:53
rp_suman23-Dec-06 22:53 
AnswerRe: Select satatment Pin
Cristian Amarie25-Dec-06 22:42
Cristian Amarie25-Dec-06 22:42 
AnswerRe: Select satatment Pin
albCode26-Dec-06 1:32
albCode26-Dec-06 1:32 
QuestionHow to fill null value for a column in Oracle Pin
NK723-Dec-06 9:35
NK723-Dec-06 9:35 
AnswerRe: How to fill null value for a column in Oracle Pin
Chris Meech24-Dec-06 12:08
Chris Meech24-Dec-06 12:08 
QuestionBuild Errors on SQL Statement Pin
Swisher2422-Dec-06 8:40
Swisher2422-Dec-06 8:40 
AnswerRe: Build Errors on SQL Statement Pin
Colin Angus Mackay22-Dec-06 10:14
Colin Angus Mackay22-Dec-06 10:14 
GeneralRe: Build Errors on SQL Statement Pin
Swisher2427-Dec-06 5:50
Swisher2427-Dec-06 5:50 
QuestionScript/tool to update schema of my database when the latest_schema script is provided Pin
PrashantJ22-Dec-06 5:36
PrashantJ22-Dec-06 5:36 
QuestionHow codeproject stores articles ? Pin
devboycpp22-Dec-06 3:59
devboycpp22-Dec-06 3:59 
QuestionSql Statement not pulling any results Pin
Almerica22-Dec-06 1:00
Almerica22-Dec-06 1:00 
AnswerRe: Sql Statement not pulling any results Pin
Pete O'Hanlon22-Dec-06 1:43
mvePete O'Hanlon22-Dec-06 1:43 
GeneralRe: Sql Statement not pulling any results Pin
Almerica22-Dec-06 2:19
Almerica22-Dec-06 2:19 

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.