While executing the code below I am getting HTTP 500 Internal Server Error.
public bool DeleteData(int dataId, string uploaderName)
{
using (DataClassesDataContext db = new DataClassesDataContext())
{
DataInfo d = db.DataInfos.Where(c => c.DataId == dataId).Single();
db.DataInfos.DeleteOnSubmit(d);
db.SubmitChanges();
}
return true;
}
This fetches the value in "d", but while executing db.SubmitChanges();
I see a 500 error. What can the reason be? The ID column is a primary key and also Identity.
Also I want to know how to implement "and" in LINQ, something like this:
DataInfo d = db.DataInfos.Where(c => c.DataId == DataId AND
c.UploaderName==uploaderName).Single();