Retain the existing db connection in a command object


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,



Just a thought....



I recently had a need to populate just a single BO on a form from a different database to the other BO's on the form. The actual database to use isn't known until runtime.



All our db access is via stored procedures in SQL Commands so, given that I had ready access to connection string I needed to use, I simply created SQL Connection, opened it and then set the SQL Commands .connection property. In tracking down why this didn't work I can see Business Layer creates a connection 'on-the-fly' and ignores what may already be there in the SQL Command object.



I was wondering if it may be useful to check if a SQL Command object already has a connection object defined and use it rather than creating a 'standard connection'. The assumption here being that if a system has gone to the trouble of creating a connection and placing it in the SQL Command object then that's the connection that should be used.



BTW - this is 'just a thought' - I have no need for this functionality as I have achieved the required results by other means.



Cheers, Peter

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search