Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Problem in asp.net application while running on liveserver
waqas khan
Nov 17 2016 5:51 AM
229
Reply
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" />
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to run progress bar while inserting data into sql?
ERROR: Method name expected