Kamlesh Kumar

Kamlesh Kumar

  • NA
  • 6
  • 2.6k

Object Reference

Jul 4 2014 6:11 AM
In Entity layer we add entity in TITLE Class as 
        public int titleId { get; set; }       
        public string titleName { get; set; }       
        public Author authorObj { get; set; }                    
        public Category categoryObj { get; set; }

In Author 
public int authorId { get; set; }       
public string authorName { get; set; }

In Category
public int categoryId { get; set; }       
public string categoryName { get; set; }       
public int price { get; set; }

In presentation layer

au.authorId = int.Parse(TextBox1.Text);               
au.authorName = TextBox2.Text;               
ca.categoryId = int.Parse(TextBox3.Text);               
ca.categoryName = TextBox4.Text;               
ca.price = int.Parse(TextBox5.Text);               
ti.titleId = int.Parse(TextBox6.Text);               
ti.titleName = TextBox7.Text;               
ti.authorObj.authorId = int.Parse(TextBox1.Text);             
ti.categoryObj.categoryId = int.Parse(TextBox3.Text);

// It showing Object reference not set to an instance error while executing,Please help me how to solve this issue.  



Answers (1)