參考:RDS Code Examples in Visual Basic
--
Dim rs As Object 'Recordset
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", _
"http://myserver")
End Sub
Private Sub Command1_Click()
'This query returns a recordset over HTTP.
Dim strCn As Variant, strSQL As Variant
strCn = "dsn=pubs;Username=
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;Username=
strSQL = "Update authors Set au_fname = 'Jon' Where au_lname" _
& " Like 's%'"
df.Query strCn, strSQL
End Sub
沒有留言:
張貼留言