Solved

Writing COM+ Application using Visual Basic

Posted on 2002-05-13
4
198 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Post a good COM tutorial 1 54
Need more details 5 149
Trouble with References... 5 54
Formula problem with Excel attachment 6 27
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

776 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