السلام عليكم ورحمه الله وبركاته
ياليت تساعودني في تصحيح الكود هذه
string con;
con = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection();
sqlcon.ConnectionString = con;
SqlCommand sqlcom = new SqlCommand();
sqlcom.Connection = sqlcon;
Button mybtn = ((Button)(sender));
DataListItem dli = ((DataListItem)(mybtn.NamingContainer));
string not = ((TextBox)dli.FindControl("TextBox3")).Text;
string command, taha;
command = "insert into nots (id_text,nots,name,img) values(@id_text,@nots,@name,@img)";
sqlcom.CommandText = command;
sqlcon.Open();
sqlcom.Parameters.AddWithValue("@id_text",Label9.Text);
sqlcom.Parameters.AddWithValue("@nots", not);
sqlcom.Parameters.AddWithValue("@name", Session["name"]);
sqlcom.Parameters.AddWithValue("@img", Session["ali"]);
taha = sqlcom.ExecuteNonQuery().ToString();
sqlcon.Close();
-------------------------------------
هذه الكود والخطاء هنا
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_nots_text". The conflict occurred in database "C:\USERS\SONY\DESKTOP\SOSO\APP_DATA\DATABASE.MDF", table "dbo.text", column 'id_text'.
The statement has been terminated