Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am working on vb.net application with ms access as back end.
I using execute-non query() for insert data. Some values are null at time of insertion. but database can't be allow (Error occurs). is it possible for to allow null value ?
Please clarify.
Thanks you.
Posted
Updated 27-Nov-11 19:10pm
v2

Set Allow NULL in the column property of the table.
and while inserting data or writing insert query dont write/ consider the column which u want to be null/ dont want to insert value.
 
Share this answer
 
Comments
RaviRanjanKr 28-Nov-11 14:57pm    
A suggestion :- Please don't use short text wods like 'u' instead of you. its not a good practice.
There are two posibilities.
1. your column is set as NOT ALLOW NULL
2. your field value is null and your are consider that column in INSERT QUERY

Make your column as ALLOW NULL and check field value for NULL before insertion.
if field value is NULL, Do not consider that column in INSET query. Database will automatically put NULL in that column.

you can ALLOW NULL your column by
SQL
ALTER TABLE TABLENAME ADD COLUMNNAME text NULL

10 tricks for handling null values in microsoft access[^]
 
Share this answer
 
v3
Comments
RaviRanjanKr 28-Nov-11 14:47pm    
I dont know why this answer got downvotes, BTW My 5+ for nice answer.
Set the properties Of Access Column "Allow Null" to Yes....And show the error if this solution is not work....:)
 
Share this answer
 
Comments
Manoj K Bhoir 28-Nov-11 1:18am    
Threre is no property in MsAccess like allow null for columns.
NikulDarji 28-Nov-11 2:03am    
Actually its "Allow Zero Length".........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900