Solved

Passing cursor to VB Com object

Posted on 2000-03-19
7
267 Views
Last Modified: 2013-11-25
How do I pass a cursor/entire record to a com object.

I create that object using sp_oaCreate


thank you
0
Comment
Question by:fkmfkm
  • 4
  • 3
7 Comments
 
LVL 7

Accepted Solution

by:
tchalkov earned 200 total points
ID: 2635463
You can't fo it directly.
Because sp_oaCreate uses some sort of hadles, you can't pass a COM object as a parameter. So you can't pass Recordset for exmaple.

A possible solution to pass a single record is to conacatenate all teh fields in the record, and separate them with some separation character. Then pass the resulting string as a parameter to the control.

As for complete recordset - either pass the query string to the com object, or copy the recordset in a table, and pass the table name to the object.
0
 

Author Comment

by:fkmfkm
ID: 2635513
I have pasted this from the SQL Books online. But I do not understand it.

1. Client ? what does it mean by client ?

2. Array ? if in TSQL how to declare an array ?

I hope u can help.


Result Sets
If the property returns an array with one or two dimensions, the array is returned to the client as a result set:

A one-dimensional array is returned to the client as a single-row result set with as many columns as there are elements in the array. In other words, the array is returned as (columns).
A two-dimensional array is returned to the client as a result set with as many columns as there are elements in the first dimension of the array and with as many rows as there are elements in the second dimension of the array. In other words, the array is returned as (columns, rows).
0
 
LVL 7

Expert Comment

by:tchalkov
ID: 2635549
The above text is about OLE Object returning arrays to the SQL Server. Not the opposite, which you are asking for.

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:fkmfkm
ID: 2662520
Sorry for taking so long to reply...


Is there any better way to do this ? I hope u can help
0
 
LVL 7

Expert Comment

by:tchalkov
ID: 2663247
I don't know any other way to do this except what I've suggested you in my answer.

However there is still something you can do - if TSQL is not enough for you then you can try to write an external stored procedure which is a DLL - VC ++ 6.0 has a wizard which helps you do that. Then you can do whatever you want in that DLL.
0
 

Author Comment

by:fkmfkm
ID: 2663714
Can it be an Active X dll written in VB

cause I dunno VC++

:) By the way thank you
0
 
LVL 7

Expert Comment

by:tchalkov
ID: 2663828
I don't know if an extended stored procedure can be written in VB. It is not an ActiveX control.

Generally the idea is that if TSQL is not enough then use something else - for example you can write an ActiveX, which calls teh SQL Server and is doing some work on the data, and call this ActiveX instead of directly calling the SQL Server.

Or you can put some of the work into an ActiveX, which you call from SQL Server using sp_oacreate
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

757 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

17 Experts available now in Live!

Get 1:1 Help Now