From 8ba44f6897241d29ca94e96631beae1260827bc0 Mon Sep 17 00:00:00 2001 From: syneffort Date: Tue, 13 Dec 2022 09:26:38 +0900 Subject: [PATCH] command builder --- SQLite_Console/PsqLiteWrapper/PSqLite.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SQLite_Console/PsqLiteWrapper/PSqLite.cs b/SQLite_Console/PsqLiteWrapper/PSqLite.cs index 63311e4..adf9078 100644 --- a/SQLite_Console/PsqLiteWrapper/PSqLite.cs +++ b/SQLite_Console/PsqLiteWrapper/PSqLite.cs @@ -168,9 +168,16 @@ namespace PSqLiteWrapper return dataSet; } - public static SQLiteDataAdapter GetAdapterSelectQuery(SQLiteConnection openedConn, string query) + public static SQLiteDataAdapter GetAdapterSelectQuery(SQLiteConnection openedConn, string query, bool withCommandBuilder = true) { SQLiteDataAdapter adapter = new SQLiteDataAdapter(query, openedConn); + if (withCommandBuilder) + { + SQLiteCommandBuilder builder = new SQLiteCommandBuilder(adapter); + adapter.UpdateCommand = builder.GetUpdateCommand(); + adapter.DeleteCommand = builder.GetDeleteCommand(); + adapter.InsertCommand = builder.GetInsertCommand(); + } return adapter; }