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: glpk xypron
Subject: Re: [Help-glpk] Connecting Excel 2007 to GLPK
Date: Thu, 29 Apr 2010 07:39:39 +0200

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 für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01




reply via email to

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