Thanks for the link Ted - I had already found that one but was a little wary
about making registry entries straight up...

Found some nifty fox code here and decided to run with that instead:
http://fox.wikis.com/wc.dll?Wiki~ProgrammaticallyCreatingDSNs

I have a system.dbf with the app that holds all info about the registered
user.  I put a logical field called firstrun into this table and in my
startup.prg put a test to see if it's the first time they are running the
app, if it is - the do the prg that sets up the DSN.  

That way - the setup of the datasource is happening through Fox, not the
Inno Setup.

Code is:

#define ODBC_ADD_DSN       1    &&' Add data source
#define ODBC_CONFIG_DSN    2    &&' Configure (edit) data source
#define ODBC_REMOVE_DSN    3    &&' Remove data source
#define vbAPINull          0    &&' NULL Pointer

 *'Function Declare
 * #If WIN32 Then
    DECLARE LONG SQLConfigDataSource IN ODBCCP32.DLL ;
       LONG hwndParent, LONG fRequest, ;
       STRING lpszDriver, STRING lpszAttributes
  *#Else
  *  Private Declare Function SQLConfigDataSource Lib "ODBCINST.DLL" _
  *    (ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal _
  *    lpszDriver As String, ByVal lpszAttributes As String) As Integer
  *#End If

  LOCAL intRet, strDriver, strAttributes

  *'Set the driver QODBC Driver.
  strDriver = "QODBC Driver for Quickbooks"  && This should be the full name
of the driver you're using...
  *'Set the attributes delimited by null.
  *'See driver documentation for a complete
  *'list of supported attributes.
  strAttributes = "SERVER=SomeServer" + Chr(0)
  strAttributes = strAttributes + "DESCRIPTION=MyDataSource" + Chr(0)
  strAttributes = strAttributes + "DSN=MyDataSource"         + Chr(0)
  strAttributes = strAttributes + "DATABASE=pubs"        + Chr(0)
  strAttributes = strAttributes + "UID=sa"               + Chr(0)
  strAttributes = strAttributes + "PWD="                 + Chr(0)
  *'To show dialog, use Form1.Hwnd instead of vbAPINull.
  intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, ;
             strDriver, strAttributes)
  If intRet>0
    =MessageBox( "DSN Created" )
  Else
    =MessageBox( "DSN Create Failed" )
  EndIf 

Happy coding!  

Tina
DataHouse
www.datahouse.com.au


-----Original Message-----
From: Ted Roche [mailto:tedro...@gmail.com] 
Sent: Wednesday, 14 September 2011 11:37 PM
To: profox@leafe.com
Subject: Re: (NF) Set up DSN in an Inno Setup - is it possible?

On Wed, Sep 14, 2011 at 12:18 AM, Tina Currie <t...@datahouse.com.au> wrote:

> As part of my install for my app, I need to install qodbc.exe (so I can
> connect to the QuickBooks Data), but then also need to set up a data
source
> name.   Can I do that through Inno?

http://www.vincenzo.net/isxkb/index.php?title=ODBC_-_How_to_create_a_DSN

found via: http://tinyurl.com/4y6ry5v


-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com




_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/04c801cc732b$e31da2e0$a958e8a0$@com.au
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to