Skip to content

Instantly share code, notes, and snippets.

@crowcoder
Last active October 15, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowcoder/d0b1214d0d4a9a8ecefbd70e511197c1 to your computer and use it in GitHub Desktop.
Save crowcoder/d0b1214d0d4a9a8ecefbd70e511197c1 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
SqlConnectionStringBuilder bldr = new SqlConnectionStringBuilder();
bldr.DataSource = "(localdb)\\DEV";
bldr.InitialCatalog = "DbParams";
bldr.ApplicationName = "ParameterBehavior";
bldr.IntegratedSecurity = true;
using (SqlConnection con = new SqlConnection(bldr.ConnectionString))
using (SqlCommand cmd = con.CreateCommand())
{
// this method call will change with each scenario to highlight
// the behavior of various command properties.
InputWithNoDefault(cmd);
con.Open();
var result = cmd.ExecuteScalar();
Console.WriteLine(result.ToString());
Console.WriteLine(cmd.Parameters["@param1"].Value);
}
Console.ReadKey();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment