Solved

Passing cursor to VB Com object

Posted on 2000-03-19
7
274 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

825 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