string ClassName;
ClassName = _table.ClassName;
string connectionAdress = @"Server = (localdb)\local; Database = StudentApp; Trusted_Connection = true";
SqlConnection connection = new SqlConnection(connectionAdress);
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = "INSERT INTO ClassTable (ClassName) VALUES (@p1)";
command.Parameters.AddWithValue("@p1", ClassName);
connection.Open();
command.ExecuteNonQuery(); // hata burada
connection.Close();
return View("Index");