dayat wrote:
yes vincent, that's my intention. forgive I make friends become to confuse. sorry, my english so poor.

Thank you for your reply.

On 4/3/07, *Vincent Snijders* < [EMAIL PROTECTED] I understood the question in a different way.

    To use an ODBC connection you need a DSN.

Well, actually you need a connection string. A connection string can specify a 
DSN, a File DSN and/or a set of connection parameters.

This implies that you do not specifically need a DSN in order to connect an 
ODBC datasource. In fact DSNs are just shortcuts to sets of parameter values.

    How can I create a DSN from my program?

    How can I delete the DSN from the system after the program has done
    its job, just
    before exiting?

The ODBC API, as documented at 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdkodbcoverview.asp,
 describes four APIs:
- ODBC API
- Setup API
- Installer API
- Translation API

An ODBC enabled application does not use all these APIs directly, but of course 
it will use the ODBC API, and if it wishes to manipulate the system ODBC 
config, it uses the Setup API.

The Setup API contains a ConfigDSN function for adding/removing/changing DSNs. 
So you can manage DSNs from your application.

However, as far as I know FPC currently only contains the ODBC API, not the 
Setup API. So you'd have to add it. Note: there are only three functions in it, 
and some of the constants are already defined in the odbcsql unit.


If your only goal is to connect to an ODBC data source, I recommend to use a 
connection string, which is formed from the properties of TODBCConnection (in 
particular Params).

Regards,

Bram

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to