[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] Connecting Excel 2007 to GLPK

**From**: |
Andrew Makhorin |

**Subject**: |
Re: [Help-glpk] Connecting Excel 2007 to GLPK |

**Date**: |
Wed, 28 Apr 2010 01:52:00 +0400 |

>* I'm trying to connect Excel 2007 to GLPKthrough ODBC, but I have a*
>* problem.*
>* I define my file in the driver Microsoft Excel Driver (*.xls,*
>* *.xlsx, *.xlsm, *.xlsb), but then when I put that in my GLPK code, I*
>* get the message "string literal too long".*
>* Here's the part of my code for that:*
>* table pq_ivt {i in I, v in V, t in T} OUT 'ODBC'*
>* 'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm,*
>* *.xlsb)};READONLY=FALSE;dbq=GEE_Outputs_April_2010.xlsx'*
>* 'INSERT INTO [Purchased Quantities - pq$]'*
>* '(Suppliers, Components, Periods, Purchased_Quantities)'*
>* 'VALUES(?, ?, ?, ?);' :*
>* i ~ Suppliers, v ~ Components, t ~ Periods, pq[i,v,t] ~ *
>* Purchased_Quantities;*
>* I also tried 'DRIVER={Microsoft Excel Driver*
>* (*.xlsx};READONLY=FALSE;dbq=GEE_Outputs_April_2010.xlsx', but still*
>* didn't work.*
>* Any help will be greatly appreciated.*
You can split a long sql statement into shorter ones, for example,
as follows (all string literals will be concatenated):
table pq_ivt {i in I, v in V, t in T} OUT 'ODBC'
'DRIVER='
'{Microsoft Excel Driver '
'(*.xls, *.xlsx, *.xlsm,*.xlsb)};'
'READONLY=FALSE;'
'dbq=GEE_Outputs_April_2010.xlsx'
'INSERT INTO [Purchased Quantities - pq$]'
'(Suppliers, Components, Periods, Purchased_Quantities)'
'VALUES(?, ?, ?, ?);' :
i ~ Suppliers, v ~ Components, t ~ Periods,
pq[i,v,t] ~ Purchased_Quantities;