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.
Loading
Khan Abrar AhmedPosted Jul 4, 2014, 6:18 AM
yo need to intialise the object or check "Textbox1" is null this error occurs when you are trying to access the null propriety.
so error should be on properyt class or element.
Resolution: put the debugger and check which property is null and then initialise that element or property.