HOWTO: Use RDS From Inside a Visual Basic ProgramID: Q165297
|
Microsoft Remote Data Service (RDS) can be used inside a Visual Basic program as easily as it can be used from inside Microsoft Internet Explorer. You are not able to bind controls to it with the RDS.DataControl as you can in Internet Explorer, but you can use the RDS.DataSpace and the RDSServer.DataFactory objects to return a recordset to your Visual Basic program with a small amount of code. With the returned recordset you can populate unbound controls.
http://www.microsoft.com/data/The client components must also be installed on the client computers. If the client computer has Internet Explorer 4.01 or greater installed, the RDS 1.5 client components are included. For clients running Internet Explorer 3.0, the client components must be downloaded to the clients computer. One way of doing this is by using a CODEBASE parameter in the OBJECT tag of an HTML page. To do this go to the sample page on your RDS Server located at:
http://[SERVER]/Msadc/Samples11/Adctest.aspThe components will automatically be installed on the client.
Dim rs As Object 'Resultset
Dim ds As Object 'RDS.DataSpace
Dim df As Object 'RDSServer.DataFactory
Private Sub Form_Load()
Set ds = CreateObject("RDS.DataSpace")
Set df = ds.CreateObject("RDSServer.DataFactory", _
"<LINK TYPE="GENERIC" VALUE="http://myserver")">http://myserver")</LINK>
End Sub
Private Sub Command1_Click()
'This query returns a recordset over HTTP.
Dim strCn As Variant, strSQL As Variant
strCn = "dsn=pubs;uid=sa;pwd="
strSQL = "select * from authors"
Set rs = df.Query(strCn, strSQL)
Debug.Print rs(0) 'Print Row 1, Col 1 to Debug window
End Sub
Private Sub Command2_Click()
'This example executes an action query but does not return
'a recordset.
Dim strCn As Variant, strSQL As Variant
strCn = "dsn=pubs;uid=sa;pwd="
strSQL = "Update authors Set au_fname = 'Jon' Where au_lname" _
& " Like 's%'"
df.Query strCn, strSQL
End Sub
For additional information, please see the following World Wide Web URL:
http://www.microsoft.com/data/rds/Remote Data Service public newsgroup:
microsoft.public.ado.rds
Additional query words: ADC
Keywords : kbprg kbRDS150 kbRDS200 kbVBp500 kbVBp600 kbGrpVBDB kbDSupport
Version : WINDOWS:1.5
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 15, 1999