help-glpk
[Top][All Lists]
Advanced

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

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


From: Aly Megahed
Subject: Re: [Help-glpk] Connecting Excel 2007 to GLPK
Date: Thu, 29 Apr 2010 19:15:12 +0400

Thanks a lot, Xypron. That worked perfectly.

Aly

----- Original Message -----
From: "glpk xypron" <address@hidden>
To: address@hidden, address@hidden
Sent: Thursday, April 29, 2010 1:39:39 AM GMT -05:00 US/Canada Eastern
Subject: Re: [Help-glpk] Connecting Excel 2007 to GLPK

Hello Aly,

> 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".

strings in GMPL are limited to 100 characters.

You can use a file DSN. Create a file with a content like:

[ODBC]
DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
DBQ=.\sudoku.xls

File DSNs can also be created using tab "File DSN" in
%WINDIR%\system32\odbcad32.exe

Change your table statements to use the file DSN, e.g.

table ta {(i, j) in {i1 in 1..9} cross {i2 in 1..9}} OUT 'ODBC'
  'FileDSN=.\sudoku_excel.dsn;READONLY=FALSE'
# ADO does not support deleting from Excel 
  'UPDATE [sudoku_solution$] SET VAL = '''';'
  'UPDATE [sudoku_solution$] SET LIN = '''';'
  'UPDATE [sudoku_solution$] SET COL = '''';'
  'UPDATE [sudoku_solution$] SET ID  = '''';'
  'INSERT INTO [sudoku_solution$]'
  '(ID, COL, LIN, VAL)'
  'VALUES(?, ?, ?, ?);' :
  id ~ ID, i ~ COL, j ~ LIN, (sum{k in 1..9} x[i,j,k] * k) ~ VAL;

Best regards

Xypron

-- 
GRATIS fur alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

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








reply via email to

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