waqas khan

waqas khan

  • NA
  • 2
  • 560

Problem in asp.net application while running on liveserver

Nov 17 2016 5:51 AM
i was trying to upload my asp.net webform website on live server . Database handled with LInq . Every thing was working fine on local host . On live server em able to get data from database . But unfortunately when i try to insert data to any table it give me the following error
 
"Cannot insert the value NULL into column 'Id', table 'db.dbo.branch'; column does not allow nulls. INSERT fails.
The statement has been terminated.
" .
 
Although in database Id is auto increment . my data insertion code is
 
public static bool addbranch(branch b) {
ctownDataContext db = new ctownDataContext(); int count = (from x in db.GetTable() where x.name == b.name || x.brachno == b.brachno select new { x.Id }).Count(); if (count == 0) { db.branches.InsertOnSubmit(b); db.SubmitChanges(); return true; } else { return false; }
}
 
while my connection string is
 
providerName="System.Data.SqlClient" />

Answers (1)