ur code also removed the error but it also gave me a runtime error
Server Error in '/ProfileSample' Application.
Violation of PRIMARY KEY constraint 'PK_info'. Cannot insert duplicate key in object 'dbo.info'.
The statement has been terminated.
Description: An
unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_info'. Cannot insert duplicate key in object 'dbo.info'.
The statement has been terminated.
Source Error:
Line 29: cmd.Parameters.AddWithValue("@second", TextBox2.Text);
Line 30: //SqlCommand myCom=new SqlCommand(st,con);
Line 31: int numrow = cmd.ExecuteNonQuery(); Line 32: con.Close();
Line 33: }
kpawii
Member
9 Points
25 Posts
Re: ExecuteNonQuery error
Apr 06, 2012 06:07 PM|LINK
ur code also removed the error but it also gave me a runtime error
Server Error in '/ProfileSample' Application.
Violation of PRIMARY KEY constraint 'PK_info'. Cannot insert duplicate key in object 'dbo.info'.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_info'. Cannot insert duplicate key in object 'dbo.info'.
The statement has been terminated.
Source Error:
Line 29: cmd.Parameters.AddWithValue("@second", TextBox2.Text); Line 30: //SqlCommand myCom=new SqlCommand(st,con); Line 31: int numrow = cmd.ExecuteNonQuery(); Line 32: con.Close(); Line 33: }