Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing cursor to VB Com object

Posted on 2000-03-19
7
Medium Priority
?
287 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 600 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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

773 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