Solved

Passing cursor to VB Com object

Posted on 2000-03-19
7
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

626 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