Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Run-time error -2147217900 (80040e14) - Invalid Sql Statement

$
0
0
Hi,
When clicking in a button i get the error -2147217900 (80040e14) "Invalid Sql Statement, expected 'DELETE','INSERT','PROCEDURE','SELECT' OR 'UPDATE'".
And it's triggered in the following line:

Code:

DataEnvironment1.Command1_Grouping DBCombo1.Text
It's supposed to open a report, using a parameterized query. The parameter is provided by the text in the dbcombo.
I set the query in design mode and when i tested it , it worked fine.

I used the help from this page:
http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx.
I can't see what is wrong, because i've done this just like the above page.

Code:

SELECT GERAL.NUM_REQ, GERAL.DATA_ENTRADA, GERAL.TIPO_REQ,
    GERAL.NNIA, GERAL.QT_PEDIDA, GERAL.QT_FORNECIDA,
    GERAL.DATA_FORNECIMENTO, GERAL.SERVICO, GERAL.NUM_SIG,
    Identart.COA, Identart.DESC_ART, Identart.COD_UF, Identart.COD_DEP,
    SERVIÇOS.NOME, SERVIÇOS.RESPONSÁVEL, GERAL.VALOR
FROM SERVIÇOS, GERAL, Identart
WHERE SERVIÇOS.`NUM_SERVIÇO` = GERAL.SERVICO AND
    GERAL.NNIA = Identart.NNIA AND GERAL.SERVICO = ?

Code:

DataReport2.Orientation = rptOrientLandscape
With DataEnvironment1.Connection1
    If .State = adStateOpen Then
    .Close
    End If
End With
DataEnvironment1.Connection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MDIForm1.bd & ";Persist Security Info=False"
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1_Grouping DBCombo1.Text
DataReport2.Show

MDIForm1.bd is the database i'm using.


Thanks in advance

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>