i want to show a msg box saying 'id exists, insert not successful' if i have an existing id but there is this error !!
protected void Button1_Click(object sender, EventArgs e)
{
int result = 0;
EventType produ = new EventType(int.Parse(tb_id.Text), tb_Name.Text);
result = produ.EventTypeInsert();
if (produ == null)
{
if (result > 0)
{
Response.Write("<script>alert('Insert successful');</script>");
}
else
{
Response.Write("<script>alert('Insert NOT successful');</script>");
}
}
else
{
Response.Write("<script>alert('ID already exists.Insert NOT successful');</script>");
}
}