Hi,
Using LINQ I wrote a code to insert a record manually in a table. It works fine. Same code is not working in my web form. Insted of manual values i set control names but not workin. It is showing me :
Can't perform Create, Update or Delete operations on 'Table(Student)' because it has no primary key.
above error: Then i set primary key to my column then also not solved.
The code for web form:
string address = "Data Source=.\sqlserver;Initial Catalog=myDB;Integrated Security=True";
StudentDataContext sdc = new StudentDataContext(address);
Student stud = new Student();
stud.RollNo = Convert.ToInt32(txtRollNo.Text);
stud.StudName = txtStudName.Text;
stud.City = ddlCity.SelectedItem.Text;
sdc.Students.InsertOnSubmit(stud);
sdc.SubmitChanges();
Above code is working fine on my console application with manual values.