一个最简单的SELECT * FROM Factory语句在 QUERY Analyzer可正常查询
在VB中利用COMMAND对象的EXECUTE方法却出现如下错误
实时错误'-2147217900(80040e14)':
Incorrect syntax near the keyword 'SELECT'.
各位大侠有未碰到过啊

解决方案 »

  1.   

    象这样:Dim adoCnn As New ADODB.Connection
     Dim adoCmm As New ADODB.Command Dim adoRec As New ADODB.Recordset adoCnn.CursorLocation = adUseClient
     adoCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;Persist Security Info=False"
     adoCmm.ActiveConnection = adoCnn
     adoCmm.CommandType = adCmdText
     adoCmm.CommandText = "select * from employees"
     Set adoRec = adoCmm.Execute
     
     Set DataGrid1.DataSource = adoRec
      

  2.   

    adoCnn.CursorLocation = adUseClient
    这样用就不会出错了