Thanks for your message.

Actually, I tried what you told me and got the following message:

"data source name not found and no default driver specified"

Do you or anyone have an idea about that? or have really connected to Excel 
2007 (a .xlsx file) before?

Thanks,

Aly

----- Original Message -----
From: "Andrew Makhorin" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Tuesday, April 27, 2010 5:52:00 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Help-glpk] Connecting Excel 2007 to GLPK

> 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;




-- 
PhD Student
Vice President, Egyptian Student Association in North America, Georgia Tech 
Chapter

Rm. 407 Main Building
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology
765 Ferst Dr., NW
Atlanta, Georgia 30332-0205, USA






_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to