Click here to Skip to main content
15,896,300 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can avoid this problem:
C#
Cannot insert the value NULL into column 'rowguid', column does not allow nulls. INSERT fails.

sample querry:
SQL
insert into tablename (col1,col2,col3)  values('v1','v2','v3')
Posted
Updated 26-Jun-13 18:32pm
v2

Check your database schema - rowguid expects a value (as 'allow nulls' is most probably false).
As a result, you get this error.

Since a guid is a unique identifier, you might need to pass a value that is appropriate. I recommend you check your entire code flow to ensure you send in the correct value.
 
Share this answer
 
v2
Check you Table design and set allow null........
 
Share this answer
 
Comments
[no name] 27-Jun-13 0:58am    
That's the lazy way out and can lead to more problems than the one it solves. The error may be gone, but what if this value is required and the program's logic does not expect null values and falls on its nose at many places because of that?

The only way to deal with this is to understand your data model. Only then you can make a decision about allowing nulls or not. If not, then the only solution would be to assure that a valid value is provided for this column when rows are inserted.
Nirav Prabtani 27-Jun-13 1:18am    
Thanks....:)
Nirav Prabtani 27-Jun-13 1:19am    
I will take care about that...:)
You can't insert null values if your 'rowguid' column is marked as Primary key.
 
Share this answer
 
v2

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