diff --git a/Netbash.Database/SqlCommand.cs b/Netbash.Database/SqlCommand.cs index b11457f..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)", @@ -214,7 +214,10 @@ private SqlConnection openConnection() var connString = getConnectionString(); var connection = new SqlConnection(connString); - + if (connection.State != ConnectionState.Open) + { + connection.Open(); + } return connection; } 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:**