Click here to Skip to main content
15,888,323 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have problem n entity frame work .

I do not Know how use stored procdure in entity frame work .

for example

this code

C#
 private FidilioEntities _db;

public string GetGoldenMember()
 {
     var res = _db.GoldenMemebrCustomer().FirstOrDefault();
     string json = JsonConvert.SerializeObject(res);
     return json;

 }

GoldenMember Stored procdure Return me list of people . but when i use it i have this error :
Object reference not set to an instance of an object


or in this code :


C#
var tt = new UserActivityVM();
      var res = _db.UsersAvtivityReport(type).FirstOrDefault();
      string jso = JsonConvert.SerializeObject(res);

      tt.UsersActivity = jso;
      return tt.UsersActivity;


UsersAvtivityReport return me only one record but same as other i Have this error
Object reference not set to an instance of an object

where is the problem ?
Posted
Updated 25-Jan-15 1:40am
v2

1 solution

Based on the error message it could be that _db is null. Using the debugger, ensure that you have initialized _db properly. That the connection really exists.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900