Last active
July 9, 2021 03:54
Revisions
-
svdamani revised this gist
Jul 9, 2021 . 1 changed file with 19 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,21 @@ public static class SqlConnectionExtensions { public static SqlCommand CreateCommand(this SqlConnection connection, string cmdText, CommandType cmdType = CommandType.Text, params SqlParameter[] parameters) { var cmd = connection.CreateCommand(); cmd.CommandText = cmdText; cmd.CommandType = cmdType; if (parameters != null) foreach (var parameter in parameters) cmd.Parameters.Add(parameter); return cmd; } public static SqlCommand CreateCommand(this SqlConnection connection, string cmdText, CommandType cmdType = CommandType.Text, Dictionary<string, object> parameters = null) { var cmd = connection.CreateCommand(); cmd.CommandText = cmdText; cmd.CommandType = cmdType; if (parameters != null) foreach (var parameter in parameters) cmd.Parameters.AddWithValue(parameter.Key, parameter.Value); return cmd; } } -
svdamani created this gist
Nov 25, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ public static class SqlConnectionExtensions { public static SqlCommand CreateCommand(this SqlConnection connection, string cmdText, CommandType cmdType = CommandType.Text, params SqlParameter[] parameters) { var cmd = connection.CreateCommand(); cmd.CommandText = cmdText; cmd.CommandType = cmdType; if (parameters != null) foreach (var parameter in parameters) cmd.Parameters.Add(parameter); return cmd; } public static SqlCommand CreateCommand(this SqlConnection connection, string cmdText, CommandType cmdType = CommandType.Text, Dictionary<string, object> parameters = null) { var cmd = connection.CreateCommand(); cmd.CommandText = cmdText; cmd.CommandType = cmdType; if (parameters != null) foreach (var parameter in parameters) cmd.Parameters.AddWithValue(parameter.Key, parameter.Value); return cmd; } }