Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

ODBC/SQL Accessing/Modifying Excel files

cfann61
Beginner
910 Views
I'm attempting to read from/write to Excel files. I've attempted to use the f90SQL.zip file that was posted by Steve, but I can't seem to get it to work. I am attempting to use ExcelReadLite.f90

I had to modify the f90sql.f90 file to get it to compile.I defined all of the interfaces after the module and implicit statements, then added a"contains" before all the functions/subroutines. After I did this it compiles, but it doesn't do anything.

I looked at the subroutines and functions in f90sql.f90, and there is nothing to them. For example, the first subroutine called in ExcelReadLite.f90 is "f90AllocHandle". It looks like this:

subroutine f90SQLAllocHandle(HandleType, InputHandle, OutputHandle, iRet)

!DEC$ ATTRIBUTES STDCALL,REFERENCE,MIXED_STR_LEN_ARG,DECORATE,ALIAS:"F90SQLALLOCHANDLE" :: f90SQLAllocHandle

!SQLAllocHandle allocates an environment, connection, statement, or descriptor handles.

!f90SQLAllocHandle

use f90SQLConstants

integer(SQLSMALLINT_KIND),intent(in)::HandleType !Type of handle

integer(SQLHANDLE_KIND),intent(in):: InputHandle !parent handle (for hdbc and stmt handles only)

integer(SQLHANDLE_KIND),intent(out):: OutputHandle !output handle

integer(SQLRETURN_KIND),intent(out):: iRet

end subroutine f90SQLAllocHandle

This subroutine doesn't do anything. Am I missing something?

Thanks in advance

0 Kudos
5 Replies
Steven_L_Intel1
Employee
910 Views
What is provided is a module with INTERFACE blocks. The actual implementation is in the supplied library. You should not need to edit anything in the supplied files.

You are supposed to USE the module to make the declarations visible, then call the routine.
0 Kudos
Arjen_Markus
Honored Contributor II
910 Views
You might alsotry the ODBC interface in my Flibs project (http://flibs.sf.net) - you wil need the CVS repository for the moment though.

Regards,

Arjen
0 Kudos
cfann61
Beginner
910 Views

I started out by creating a new project and adding the ExcelReadLite.f90 file. I am using VS .NET 2003, so I added the lib and include folders from the .zipin Tools->Options->Intel Fortran. When I tried to compile, I got a bunch of unresolved external errors, i.e.:

unresolved external symbol _F90SQLALLOCHANDLE@16 referenced in function _MAIN__

There were quite a few others as well. What could be causing this?

0 Kudos
Paul_Curtis
Valued Contributor I
910 Views
See the attached code template for shelling out to Excel as a child process and transferring objects (text, numbers) from F90 code to spreadsheet cells.
0 Kudos
cfann61
Beginner
910 Views

I was able to get it to compile. The ExcelRead and ExcelWrite examples are working fine, but the ExcelUpdate examlpe is not. I'm getting an error when it executes the UPDATE statement. The statement is:

UPDATE [Sheet1$] SET X=x, Y=y WHERE ID=i

where i, x, and y are variables

Example then calls f90SQLExecDirect, this returns an error, -1.

Is there a way I can tell what the error is from the error dialogs it prints out?

0 Kudos
Reply