VistaDB 6
VistaDB / Developer's Guide / CLR Stored Procedures and Functions / Technical Details of CLR Procs and Functions / Database Connections in a CLR Procedure
In This Topic
    Database Connections in a CLR Procedure
    In This Topic

    Inside the database?

    Connecting to the database when you are already running internal to it can be confusing. You are already loaded into to the engine, and are operating on values directly inside the engine. But how do you send data back to the client who called you?

    ADO.Net Interface

    From the ADO.Net interface (using SQL) you would use the Context Connection to tell the engine you want the internal connection (this will fail if called externally).

    Using Example to ensure Dispose
    Copy Code
    using (VistaDBConnection conn = new VistaDBConnection("Context Connection=true"))
        //your code here

    This tells the VistaDBConnection to use the internal Context Connection rather than allocating a new connection to the database on disk. This is the exact same syntax as SQL Server 2005 and higher.

    See Also