Need assistance with fpODBC
Rick Hane
rhane at deluxestitcher.com
Tue Oct 23 11:35:13 PDT 2012
Sorry [ top posted ]
Ken,
Much thanks. This may be doable.
One question. I have the manual from the fp class on ODBC I took at
home. Do you know if it is available on the fpTech site and as a pdf or
Windows help file. It would be a lot easier than carrying that large
binder around with me.
Thanks again,
Rick
-----Original Message-----
From: Kenneth Brody [mailto:kenbrody at spamcop.net]
Sent: Tuesday, October 23, 2012 1:01 PM
To: Rick Hane
Cc: Richard Hane; file Pro Mailing List
Subject: Re: Need assistance with fpODBC
On 10/23/2012 10:56 AM, Rick Hane wrote:
> Hi Rich,
>
> I think I was not clear in my email. Of course fp reads Excel files
> via import. That is the step I want to remove.
>
> I want to set up the fpODBC to read the data directly from the SQL
> data base. I know this is possible. The problem is how.
[...]
Since you say you only need to import the data, rather than have "live"
access to it, you can use a simple low-level ODBC query to get the data
and import it into filePro.
Basically:
Establish the connection:
handle = new odbc_connection( DSN )
(You need to determine the appropriate DSN to connect to your SQL
database.)
(Check for a positive "handle" value, to make sure it succeeded.)
Create a query handle:
qhandle = new odbc(handle)
(Check for a positive handle value, to make sure it succeeded.)
Query the database:
odbc qhandle query "select * from mytable"
(Adjust the query as appropriate, including a possible "where" clause.)
(Check for a null @odbcerror["1"], to make sure it succeeded.)
Use the @odbc.qhandle[] array to access the fields, and post as
appropriate.
Scroll through the records using:
odbc qhandle getnext
and use @odbc.qhandle.eof[] to test for end-of-file.
--
Kenneth Brody
More information about the Filepro-list
mailing list