help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] ODBC Connection to MS-Access - WHERE Clause Syntax probl


From: glpk xypron
Subject: Re: [Help-glpk] ODBC Connection to MS-Access - WHERE Clause Syntax problems
Date: Sun, 26 Jun 2011 08:45:57 +0200

Hello Alex,

> 07002:1:-3010:[Microsoft][ODBC Microsoft Access Driver] Too few
> parameters. Expected 1.
The statement
SELECT Product, MaterialDesc as pdesc, [Manuf Code] as prodman,
QPer FROM qProductsUnique  WHERE qProductsUnique.[Manuf Code]="0012LBLK"
is legal in Access 2007 when executed via the "SQL-View" of a
query.

I was able to reproduce the problem for:
Windows 7 32bit
GLPK 4.45
Access 2007 (Microsoft Office Proffesional Plus)

Access expects strings to be enclosed in  apostrophes when called
via ODBC.

Please write the table statement like this:

table products_table IN "ODBC"
        'DSN=glpk_Sales'
        'SELECT Product, MaterialDesc as pdesc,'
        '[Manuf Code] as prodman, QPer'
        'FROM qProductsUnique '
        'WHERE [Manuf Code] = ''0012LBLK'';' 
        :
        psold <- [Product, pdesc, prodman], qper~QPer; 

I now have added a remark in the Wikibook:
http://en.wikibooks.org/wiki/GLPK/ODBC#Microsoft_Access

> I don't know what the D means after [0012LBLK].
The D should not be displayed.

Could you please, specify which version of Windows, GLPK,
and MS Access you are using.

Best regards

Xypron

-------- Original-Nachricht --------
> Datum: Sun, 26 Jun 2011 04:29:47 +1000
> Betreff: [Help-glpk] ODBC Connection to MS-Access - WHERE Clause Syntax       
> problems

> Hello,
> 
> I am using the following:
> 
> set psold dimen 3;
> param qper{(i,j,k) in psold};
> 
> table products_table IN "ODBC"
>       'DSN=glpk_Sales'
>       'SELECT Product, MaterialDesc as pdesc, [Manuf Code] as prodman,
> QPer'
>       'FROM qProductsUnique '
>       'WHERE qProductsUnique.[Manuf Code]="0012LBLK"':
>       psold <- [Product, pdesc, prodman], qper~QPer;
> 
> display psold;
> ------------------------------------------
> qProductsUnique is a MS Access Query that returns unique records.  The
> data (0012LBLK) exists in the query.
> 
> I have tried many different syntax constructions for the WHERE clause
> and none work.  Removing the WHERE clause works fine, which suggests (to
> me the novice) that all of the field names are correctly specified.
> 
> For the above WHERE clause syntax the following error is received:
> 
> =====
> The driver reported the following diagnostics whilst running
> SQLExecDirect
> 42000:1:-3100:[Microsoft][ODBC Microsoft Access Driver] Syntax error
> (missing operator) in query expression 'qProductsUnique.[Manuf
> Code]=[0012LBLK]D'.
> Yorke.mod:155: error on opening table products_table
> =====
> I don't know what the D means after [0012LBLK].
> I really want to restrict the records to the following
>       'WHERE qProductsUnique.[Manuf Code] Not Like "_*"':
> But that would not work also - and that is why I tried something that I
> thought was simple.
> I am not a programmer and do not understand the ODBC / SQL syntax.  I
> have spent a long time researching these errors and found nothing that I
> believe will help.
> I have placed a space at the end of the FROM clause - I would appreciate
> if someone would also confirm if that is necessary.  When I remove the
> space at the end of the FROM clause I get a different error message --
> =====
> The driver reported the following diagnostics whilst running
> SQLExecDirect
> 07002:1:-3010:[Microsoft][ODBC Microsoft Access Driver] Too few
> parameters. Expected 1.
> Yorke.mod:155: error on opening table products_table
> =====
> I would appreciate any assistance.
> 
> Regards, Alex 

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]