Recieving the error "Dynamic SQL generation is not supported against multiple base tables." When pressing the save button

Code for Save button:

private void btnSave_Click(object sender, EventArgs e)
        {
            DataGridQuestions.EndEdit();
            adapter.Update(ds, "Questions");
            MessageBox.Show("Updated");
            DataBind(); 
        }

Code for filling data adapter

 private void DataBind()
        {
            string connectionString = ("Data Source=" + Globals.SavePath + ";");

            if (cmbName.Text == "User1")
            {
                SQL = "SELECT AreaName, Question, User1Comment, User1Score FROM Questions WHERE AreaName IN (SELECT AreaName FROM Areas WHERE User1 = 'true');";
            }

            if (cmbName.Text == "User2")
            {
                SQL = "SELECT AreaName, Question, User2Comment, User2Score FROM Questions WHERE AreaName IN (SELECT AreaName FROM Areas WHERE User2 = 'true');";
            }

                connection.Open();
                command = connection.CreateCommand();
                command.CommandText = SQL;
                adapter = new SQLiteDataAdapter(SQL, connection);
                SQLcommandBuilder = new SQLiteCommandBuilder(adapter);
                DataGridQuestions.AutoGenerateColumns = true;
                ds = new DataSet();
                adapter.Fill(ds, "MaturityQuestions");
                BindingSource b1 = new BindingSource();
                b1.DataSource = ds;
                DataGridQuestions.AutoResizeColumns(
                DataGridViewAutoSizeColumnsMode.AllCells);
                DataGridQuestions.DataSource = ds;
                DataGridQuestions.DataMember = "Questions";
                connection.Close();
        }

ManyThanks!!

Issue solved, I'd missed out the Primary Key from the original SELECT statement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.