|
-
December 8th, 1999, 02:44 AM
#1
How to design a middle level object like ADO
How to design a class that can excute a stored procedure in the server and accept a set of records from the stored procedure. It looks like ADO.
Thanks in advance
-
December 8th, 1999, 03:06 AM
#2
Re: How to design a middle level object like ADO
in VB6 you can add a class to your project and select "Data Source" as Class Type.
This will add a class module with properties like:
DataSourceBehavior = vbDataSource
...and add a class member function GetDataMember
In your class write regular ADO code...
-
December 8th, 1999, 08:36 PM
#3
More detailed info
Can you give more detailed information in the GetDataMember and in the stored procedure?
.How does the function GetDataMember receive a record set from the procedure runing in the server?
.How can a stored procedure return a record set to VB program?
.Can you give me a pseudo code?
-
December 9th, 1999, 02:52 AM
#4
Re: More detailed info
ok, here is some pseudocode
public function GetDataMember (..) as ADO.Recordset
dim rs as ado.recordset
dim cmd as ado.command
set cmd.activeconnection = yourconnectionobject
cmd.Commandtype = adcmdStoredProc
cmd.CommandText = yourspname
cmd.parameters.refresh
cmd.parameters(...).value = ... ' fill your params here
rs.Open cmd
set getDataMember = rs
end function
-
December 9th, 1999, 03:17 AM
#5
Re: More detailed info
The expected functionality of the "middle level" is to accept a group of records from a stored procedure. If the client is like your psuedo code, what does the procedure look like?
Thanks.
-
December 9th, 1999, 03:19 AM
#6
Re: More detailed info
well, the code I posted refers to the middle tier, i.e. the one that returns the recordset to the client.
What the client code looks like?
it could really be no code!
no kidding. If you use an ADO Data Control you could just set the DataMember property of that control accordingly and, voila, get the data without writing any code.
-
December 9th, 1999, 05:59 AM
#7
I tried, but failed.
I tried follow you, but I failed to get a recordset.
I defined a variable as ROWTYPE%, and select * into the variable from <a table> where clause to ensure that there is only one record is selected.
But on the client, after rs.open cmd, the recordset rs is garbage.
If your solution do work, please give me a detailed explaination.
.How to write the procedure
.How to set the DataMember property.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|