kentico - Auto Increment for Custom Module ID's -


i've created custom module called "hospital" advance developer course project. in it, i've created class named "doctor" doctorid, doctorname, doctoremail, doctorspecialty

when attempt make new doctor record via module i'm given sql error.

cannot insert value null column 'doctorid', table 'hospital.dbo.hospital_doctor'; column not allow nulls. 

shouldn't database automatically set auto-incrememnt? or did miss step. doctorid column generated cms, cannot customize it.

yes, system should automatically generate id. i'd try create custom class again, maybe went wrong during setup.

if want debug issue can try enabling sql profiler see sql query gets executed. if don't have sufficient license run profiler, try using built in kentico sql debug.

you can check info/infoprovider class code files see if class setup correctly. focus on typeinfo object, e.g. in example below officeid field set auto increment:

    /// <summary>     /// type information.     /// </summary>     #warning "you need configure type info."      public static objecttypeinfo typeinfo = new objecttypeinfo(typeof(officeinfoprovider), object_type, "officeoverview.office", "officeid", "officelastmodified", "officeguid", "officename", "officedisplayname", null, null, null, null)     {         modulename = "officeoverview",         touchcachedependencies = true,     }; 

Comments