Я нашел решение.Вы должны включать внешние ключи Pragma в коде C # каждый раз, когда вы устанавливаете соединение.Позвольте мне поделиться своим кодом:
conn.Open();
string query = " insert into Installment_Details (Account_No,Month_yr,Date,Receipt_No,Amount_Received,Amount_Left,Amount_receiver) values ('" + this.Textbox_AN.Text + "','" + this.Textbox_MY.Text + "','" + this.Textbox_D.Text + "','" + this.Textbox_RN.Text + "','" + this.Textbox_AR.Text + "','" + this.Textbox_AL.Text + "','" + this.Textbox_ARR.Text + "');";
SQLiteCommand createcommand = new SQLiteCommand("PRAGMA foreign_keys = ON", conn);
createcommand.ExecuteNonQuery();
createcommand = new SQLiteCommand(query, conn);
createcommand.ExecuteNonQuery();
MessageBox.Show("Saved Successfully");