I tried to run a query against a MS Access database with RDS in VB via
a DSN 'My_DB' and getting the following error:
[Microsoft][ODBC Microsoft Access Driver]Invalid SQL Statement;
expected 'DELETE','INSERT','PROCEDURE','SELECT' or 'UPDATE'.
I have configured the MDAC 'Directory Security' and set the
following in msdfmap.ini
[connect default]
Access=ReadWrite
The VB code that I used is enclosed in the bottom part of this submission.
As the SQL statement is so simple I can't see why should it be
an invalid statement. I guess there must be some setup related
problem in my environment.
Can someone please help me to resolve this problem? Thanks.
;My VB Code.
Option Explicit
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://SERVER-DEV")
End Sub
Private Sub Command1_Click()
'This query returns a recordset over HTTP.
Dim strCn As Variant, strSQL As Variant
strCn = "dsn=My_DB;uid=sa;pwd="
strSQL = "SELECT * from Account_Info"
Set rs = df.Query(strCn, strSQL)
End Sub