narasiman man

narasiman man

  • NA
  • 0
  • 118.9k

While insert Record it will display message recordalready exists Visual studio 2005 with SQL Server

Dec 24 2011 10:44 AM
While insert same  Record it will display message recordalready exists Visual studio 2005 with SQL Server


textbox1 = Projectcode

textbox2 = Projectname
textbox3 = ProjectDesc
textbox4 = Cost

my code:


protected void Button1_Click(object sender, EventArgs e)
{
con.Open();

str = "insert into Project values('"+TextBox1.Text+"','" + TextBox2.Text + "','" + TextBox3.Text + "'," + TextBox4.Text + ")";

cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();

Response.Write("Record inserted Successfully");
con.Close();
}


Answers (3)