10 TIPs - To Become a Good Developer/Programmer
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Raju Fodse
1.9k
235
20.7k
object reference not set to an instance of an object error
Sep 20 2018 3:03 AM
I have controller to save record. and my code is as follows
[HttpPost]
public
ActionResult CreateP3(Process process)
{
var tr = process.StageID + process.PIPENO + process.Status;
var checkme = (from x
in
db.Processes
where x.StageID + x.PIPENO + x.Status == tr && x.Status ==
"OK"
select x).ToList();
if
(checkme.Count > 0)
{
ModelState.AddModelError(
"PIPENO"
,
"You are trying Duplicate Pipe Entry"
);
}
if
(ModelState.IsValid)
{
if
(process.PipeAl.Order.THK > 1)
{
process.MPP = 20;
}
else
{
process.MPP = 1;
}
process.CuttingSpeed = (process.ActualMeter*1000)/process.CuttingTime;
db.Processes.Add(process);
db.SaveChanges();
return
RedirectToAction(
"IndexP3"
);
}
But I get object reference not set on an instance of an object error. Pls help
Reply
Answers (
5
)
ssms is not getting pls tell me the downloading link
How to get value of GridView BoundField Visible = False