0

I have a problem with a windows CE program I tested my code in an emulator with my visual studio 2005 and works nice The program should insert a number in a table from ms server but when i tried to run my program in the real device i get the error from try to insert null value in a non-null field

This is muy table

id      (int)  <<-- this field is a identity
codigo (int)  

And this is my insert query:

INSERT INTO codigos (codigo) VALUES variable_codigo

I dont know why in the emulator works but in the real device not =/

Thnks

Mikael Eriksson
  • 136,425
  • 22
  • 210
  • 281
Mirdrack
  • 780
  • 12
  • 28
  • 2
    You would get that error if the ID field is **not** defined as `identity`. I think you should recheck the table structure on your device. – Mikael Eriksson Feb 04 '12 at 16:37

2 Answers2

2

Your column names don't match (is it coding or codigo), your VALUES syntax isn't correct, and you haven't defined the schema for your table. Perhaps there are multiple tables with the same name under different schema, or there is some other careless error going on (as Mikael suggested, I suspect that either the column is not an IDENTITY column or you are looking at the wrong table).

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
0
  1. sp_help

check if Id col is identity

  1. What's the value for variable_codigo? Can it be NULL? Is the column codigo NOT NULL in table?
2lazydba
  • 398
  • 3
  • 10