Solved

Writing COM+ Application using Visual Basic

Posted on 2002-05-13
4
177 Views
Last Modified: 2013-11-25
Hi,
     Can i have some guideline regarding how to use stored procedure (MS SQL Server 7.0) in VB coding (writing the .dll file)??? How to return the recordset after execute the related stored procedure???
     Can COM+ communicate well with stored procedure in MS SQL Server 7.0??
     Thanks for ur help.

Rgds,
sityee
0
Comment
Question by:sityee
  • 2
4 Comments
 

Expert Comment

by:HeN_da_MaN
ID: 7005802
0
 

Expert Comment

by:HeN_da_MaN
ID: 7005817
0
 
LVL 18

Accepted Solution

by:
mdougan earned 50 total points
ID: 7005939
Here is the best reference I've found on-line for COM+ application guidelines for VB.  I followed these very carefully and had great success.

Yes, COM+ components have no trouble connecting to SQL Server and running stored procedures.  The only thing you have to decide is how you want to handle security.  We had our component read in a connect string during initialization, and this allowed us to change databases without having to recompile the application.  Then, we just set up one database user that the component would log in as.

If you're using COM+ make sure not to put any transactional logic in your stored  procedures (no Begin Transaction, Commit Transaction etc.).  All of that should be left to the transaction manager through SetComplete, SetAbort statements issued by your component.

We made all of our calls to our middle-tier components (and thus to the database) "stateless", meaning that we called a method in the component, and it didn't rely on any data (state) being saved from previous calls to the component.  Each method call would vote to either SetComplete or SetAbort the transaction.

If you need an example of making an ADO query to return a recordset let me know.  Oh, one other thing, Recordsets are kind of big objects to be passing from one tier to another tier, so, what we'd done is save the recordset out as an XML string (using the Recordset's Save method) and then passed back the XML string to the client Front End.  This was much faster than passing back a recordset.

Try to design your COM+ components so that all of the parameters that you pass to the methods in those components are pass ByVal, because there is a lot of overhead involved if you pass something to a COM+ component ByRef (which is the VB default)
0
 
LVL 5

Expert Comment

by:raizon
ID: 7006026
listening
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now