Last active
October 15, 2016 14:26
-
-
Save crowcoder/d0b1214d0d4a9a8ecefbd70e511197c1 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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