The following example shows how to create an rdoResultset in code and pass it to an existing RemoteData control:
Option Explicit
Dim qy As rdoQuery
Dim rs As rdoResultset
Dim cn As rdoConnection
Private Sub Form_Load()
Dim SQL As String
Set cn = MSRDC1.Connection
SQL = "{ call ChooseAuthor (?) }"
Set qy = cn.CreateQuery("GetAuthor", SQL)
End Sub
Private Sub Search_Click()
qy(0) = NameWanted.Text
Set MSRDC1.Resultset = qy.OpenResultset( _
rdOpenStatic, rdConcurReadOnly)
End Sub
The stored procedure executed by the query example is shown below:
CREATE PROCEDURE ChooseAuthor (@authorwanted char(20)) as
select t.title from titles t, titleauthor ta, authors a
where t.title_id = ta.title_id
and ta.au_id = a.au_id
and a.au_lname = @authorWanted