[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Writing COM+ Application using Visual Basic

Posted on 2002-05-13
4
Medium Priority
?
224 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
 
LVL 18

Accepted Solution

by:
mdougan earned 150 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

873 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