IL Code for Freya.Demos.SqlServer.Program.Main

Back to source code.

.method private hidebysig static void Main() cil managed
{
    .entrypoint
    // Code Size: 161 byte(s)
    .maxstack 15
    .locals init (
          [0] [System.Data]System.Data.SqlClient.SqlConnection connection1,
          [1] [System.Data]System.Data.SqlClient.SqlCommand command1,
          [2] [System.Data]System.Data.SqlClient.SqlDataReader reader1,
          [3] [mscorlib]System.Exception exception1)

    L_0000: ldstr "database=Northwind;Integrated Security=true;server=(local);"
    L_0005: newobj instance void [System.Data]System.Data.SqlClient.SqlConnection::
                  .ctor(string)
    L_000a: stloc.0
    L_000b: ldstr "select CustomerID, CompanyName from dbo.customers"
    L_0010: ldloc.0
    L_0011: newobj instance void [System.Data]System.Data.SqlClient.SqlCommand::
                  .ctor(string, [System.Data]System.Data.SqlClient.SqlConnection)
    L_0016: stloc.1
    L_0017: ldloc.0
    L_0018: callvirt instance void
                  [System.Data]System.Data.SqlClient.SqlConnection::Open()
    L_001d: ldloc.1
    L_001e: call instance [System.Data]System.Data.SqlClient.SqlDataReader
                  [System.Data]System.Data.SqlClient.SqlCommand::ExecuteReader()
    L_0023: stloc.2
    L_0024: br.s L_004b
    L_0026: ldstr "{0}: {1}"
    L_002b: ldloc.2
    L_002c: ldstr "CustomerID"
    L_0031: callvirt instance object
                  [System.Data]System.Data.SqlClient.SqlDataReader::get_Item(string)
    L_0036: ldloc.2
    L_0037: ldstr "CompanyName"
    L_003c: callvirt instance object
                  [System.Data]System.Data.SqlClient.SqlDataReader::get_Item(string)
    L_0041: call string string::Format(string, object, object)
    L_0046: call void [mscorlib]System.Console::WriteLine(string)
    L_004b: ldloc.2
    L_004c: callvirt instance bool
                  [System.Data]System.Data.SqlClient.SqlDataReader::Read()
    L_0051: brtrue.s L_0026
    L_0053: leave L_0062
    L_0058: ldloc.2
    L_0059: brfalse.s L_0061
    L_005b: ldloc.2
    L_005c: callvirt instance void [mscorlib]System.IDisposable::Dispose()
    L_0061: endfinally
    L_0062: leave L_0071
    L_0067: ldloc.1
    L_0068: brfalse.s L_0070
    L_006a: ldloc.1
    L_006b: callvirt instance void [mscorlib]System.IDisposable::Dispose()
    L_0070: endfinally
    L_0071: leave L_0080
    L_0076: ldloc.0
    L_0077: brfalse.s L_007f
    L_0079: ldloc.0
    L_007a: callvirt instance void [mscorlib]System.IDisposable::Dispose()
    L_007f: endfinally
    L_0080: leave L_00a0
    L_0085: stloc.3
    L_0086: ldstr "An exception has been caught:"
    L_008b: call void [mscorlib]System.Console::WriteLine(string)
    L_0090: ldloc.3
    L_0091: callvirt instance string [mscorlib]System.Exception::get_Message()
    L_0096: call void [mscorlib]System.Console::WriteLine(string)
    L_009b: leave L_00a0
    L_00a0: ret

    .try L_0024 to L_0058 finally handler L_0058 to L_0062
    .try L_0017 to L_0067 finally handler L_0067 to L_0071
    .try L_000b to L_0076 finally handler L_0076 to L_0080
    .try L_0000 to L_0085 catch [mscorlib]System.Exception handler L_0085 to L_00a0
}