Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 07, 2008 06:11 AM by arunvinoth
Member
34 Points
235 Posts
Dec 11, 2007 01:05 PM|LINK
hi all!
I have a task, for example, to create a record for bill.
I have table which represents this bill entity (Bill_ID, Amount, CreationDate, ExposureDate, PaymentDate)
In table definition date fields allow null.
I would like to create bill, which means insert record: (new_bill_id, 1000, 2007.12.11, null, null)
But it couses exception. Smth like: System.Data.SqlTypes.SqlTypeException, date should be not null.
How could I do it?
Please advice!
155 Points
39 Posts
Dec 11, 2007 01:25 PM|LINK
dive some code... are you using dataset or something??
Dec 11, 2007 01:36 PM|LINK
Yes I use Dataset
In properties of the field dafault value is dbnull and behavior on Null is throw exception.
Participant
978 Points
181 Posts
Dec 11, 2007 01:43 PM|LINK
Hi,
Please check sql table column constraints it may be not null column.
can you post your sample code
Dec 11, 2007 01:45 PM|LINK
set allow null for this column in dataset. and try use this...
row.SetPaymentDateNull();
248 Points
46 Posts
Jan 07, 2008 06:11 AM|LINK
hi
u can send DBNull.Value from front end
or sending empty string & checking in stored procedure for empty string to send null value from SP to table.
Vorlosha
Member
34 Points
235 Posts
how to insert null into date field?
Dec 11, 2007 01:05 PM|LINK
hi all!
I have a task, for example, to create a record for bill.
I have table which represents this bill entity (Bill_ID, Amount, CreationDate, ExposureDate, PaymentDate)
In table definition date fields allow null.
I would like to create bill, which means insert record: (new_bill_id, 1000, 2007.12.11, null, null)
But it couses exception. Smth like: System.Data.SqlTypes.SqlTypeException, date should be not null.
How could I do it?
Please advice!
szyder
Member
155 Points
39 Posts
Re: how to insert null into date field?
Dec 11, 2007 01:25 PM|LINK
dive some code... are you using dataset or something??
Vorlosha
Member
34 Points
235 Posts
Re: how to insert null into date field?
Dec 11, 2007 01:36 PM|LINK
Yes I use Dataset
In properties of the field dafault value is dbnull and behavior on Null is throw exception.
dhanabalanr
Participant
978 Points
181 Posts
Re: how to insert null into date field?
Dec 11, 2007 01:43 PM|LINK
Hi,
Please check sql table column constraints it may be not null column.
can you post your sample code
Dhana
Dont forget to mark as answer if my reply helped you...
szyder
Member
155 Points
39 Posts
Re: how to insert null into date field?
Dec 11, 2007 01:45 PM|LINK
set allow null for this column in dataset. and try use this...
row.SetPaymentDateNull();
arunvinoth
Member
248 Points
46 Posts
Re: how to insert null into date field?
Jan 07, 2008 06:11 AM|LINK
hi
u can send DBNull.Value from front end
or sending empty string & checking in stored procedure for empty string to send null value from SP to table.