From 279401c2989aa2c04c568acd5ab36e121acb457e Mon Sep 17 00:00:00 2001 From: Bart De Meyer Date: Wed, 3 Oct 2012 09:33:12 +0200 Subject: [PATCH 1/3] Added check if SQL connection is open to solve NonQuery issue Added check if SQL connection is open to solve NonQuery issue --- Netbash.Database/SqlCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Netbash.Database/SqlCommand.cs b/Netbash.Database/SqlCommand.cs index b11457f..2cf12c6 100644 --- a/Netbash.Database/SqlCommand.cs +++ b/Netbash.Database/SqlCommand.cs @@ -214,7 +214,10 @@ private SqlConnection openConnection() var connString = getConnectionString(); var connection = new SqlConnection(connString); - + if (connection.State != ConnectionState.Open) + { + connection.Open(); + } return connection; } From e5a84781ff5657c9593da8979bacd70ddbea1459 Mon Sep 17 00:00:00 2001 From: Bart De Meyer Date: Wed, 3 Oct 2012 09:38:28 +0200 Subject: [PATCH 2/3] Update README.md Update README.md to add the 2 new options --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2758e48..4a7549d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,11 @@ Simple commands to query your database with NetBash. ConnectionString name can b -t, --tables Lists tables and space used optional filter on provided table name -s, --schema Display table schema for the provided table name --clear Removes all rows from database + -cn --cn Returns the connectionstring that will be used + -lcn --lcn List all connectionstrings found in the config file -c, --conn=VALUE name of connection string to use (defaults to first found) -h, --help show this list of options + **Basic usage:** From 00cb6b54a14001b8d32d0bde0cf04d4428a41f85 Mon Sep 17 00:00:00 2001 From: Bart De Meyer Date: Wed, 3 Oct 2012 09:38:54 +0200 Subject: [PATCH 3/3] Update help message so it would be the same as README.md --- Netbash.Database/SqlCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Netbash.Database/SqlCommand.cs b/Netbash.Database/SqlCommand.cs index 2cf12c6..ac47c38 100644 --- a/Netbash.Database/SqlCommand.cs +++ b/Netbash.Database/SqlCommand.cs @@ -41,7 +41,7 @@ public string Process(string[] args) { "cn|connectionstring","Returns the connectionstring name that will be used", v=>_command=Command.ConnectionStringName}, - { "lcn|listcn","Shows all connectionstring names found", + { "lcn|listcn","List all connectionstrings found in the config file", v=>_command = Command.ListConnectionStrings}, { "c=|conn=", "Name of connection string to use (defaults to first found)",