Thanks for the feedback. May I know how can I create
the datasource automatically in my ODBC by using 
VB5 ? Besides the coding given below is there an
alternative way to auto create ? 
Thanks for all the help and feedback provided.

--- Rick Rose <[EMAIL PROTECTED]> wrote:

> You didn't leave anything out.  It was written in
> VB6, that might be the
> problem. 
>  
> Rick Rose
> -------Original Message-------
>  
> From: [EMAIL PROTECTED]
> Date: 10/12/04 22:29:27
> To: [EMAIL PROTECTED]
> Subject: RE: [vbhelp] Creating an ODBC Source
> programatically
>  
> Hi, found this topic quite interesting as currently
> my
> case is same like Daniel as I have to manually setup
> the access database in my ODBC.
> I tried the codes given below, but I cant create it.
> There is no error prompted out. Currently, I'm using
> VB5 and Ms Access 97. The only output i can see is,
> the variable "blnRetVal" returns as False. I cant
> see
> the access database being setup in my ODBC under
> User
> DSN. I have passed in the correct DSN name and also
> the full path on where my database is stored. Did i
> leave something out ?
> --- Daniel Magliola <[EMAIL PROTECTED]>
> wrote:
>  
> > Rick,
> >
> > Thanks a lot for your answer!
> > It was very helpful.
> > I have one more about this.
> > Do you know if there's an API (or any way,
> actually)
> > to display the  "Manage
> > ODBC Drivers" screen? I mean the one you usually
> use
> > in Windows to set-up
> > ODBC DSNs.
> >
> > I've seen a couple of software products display
> that
> > screen, for the
> > convenience of the user, so that they don't have
> to
> > manually navigate there.
> >
> > Thanks in Advance
> > Daniel
> >
> > > -----Mensaje original-----
> > > De: Rick Rose [mailto:[EMAIL PROTECTED]
> > > Enviado el: Monday, September 27, 2004 15:50
> > > Para: [EMAIL PROTECTED]
> > > Asunto: Re: [vbhelp] Creating an ODBC Source
> > programatically
> > >
> > >
> > > This will create an ODBC DSN for an Access
> > database.
> > >
> > > Public Declare Function SQLConfigDataSource Lib
> > "ODBCCP32.DLL" _
> > >                 (ByVal hwndParent As Long, ByVal
> > fRequest As Long, _
> > >                 ByVal lpszDriver As String,
> ByVal
> > lpszAttributes
> > > As String)
> > > As Long
> > >
> > > Public Function CreateAccessDSN(DSNName As
> String,
> > DatabaseFullPath As
> > > String) _
> > >         As Boolean
> > >     Dim sAttributes As String
> > >     sAttributes = "DSN=" & DSNName
> > >     sAttributes = sAttributes & "DBQ=" &
> > DatabaseFullPath
> > >     CreateAccessDSN = CreateDSN("Microsoft
> Access
> > Driver (*.mdb)",
> > > sAttributes)
> > > End Function
> > >
> > > Public Function CreateDSN(Driver As String,
> > Attributes As String)
> > > As Boolean
> > >     CreateDSN = SQLConfigDataSource(0&, 1,
> Driver,
> > Attributes)
> > > End Function
> > >
> > > Public Sub Create()
> > >     Dim blnRetVal As Boolean
> > >     blnRetVal = CreateAccessDSN("DSNName",
> > "C:\myDatabase.mdb")
> > > End Sub
> > >
> > >
> > > Rick Rose
> > > -------Original Message-------
> > >
> > > From: [EMAIL PROTECTED]
> > > Date: 09/27/04 11:14:05
> > > To: [EMAIL PROTECTED]
> > > Subject: [vbhelp] Creating an ODBC Source
> > programatically
> > >
> > > Dear Group:
> > >
> > > I've faced this problem several times already,
> and
> > i've never found a
> > > "civilized" solution...
> > >
> > > I have to create an ODBC Source programatically.
> > I've seen
> > > several programs
> > > do this, they create their own ODBC sources
> > instead of making you create
> > > them manually, but i've never found the way to
> do
> > it.
> > >
> > > I seriously want to believe there's a better way
> > than manually writing
> > > Hard-coded values to the Registry (inside
> > HKLM\Software\ODBC\ODBC.INI).
> > >
> > > Does anyone know how to go around doing this?
> > > I imagine this will be different for every
> driver.
> > The one i'm most
> > > interested in is IBM "Client Access" (or
> "iSeries
> > Access"), but any driver
> > > will do, it will point me in the right direction
> > at least.
> > >
> > > Thanks a lot in advance
> > >
> > > Daniel Magliola
> > > Cimatic SRL
> > > +5411 4787 5311
> > >
> > >
> > >
> > >
> > >
> > > '//
> >
>
=======================================================
> > >     Rules :
> > http://ReliableAnswers.com/List/Rules.asp
> > >     Home  :
> http://groups.yahoo.com/group/vbHelp/
> > >
> >
>
=======================================================
> > >     Post  : [EMAIL PROTECTED]
> > >     Join  : [EMAIL PROTECTED]
> > >     Leave : [EMAIL PROTECTED]
> > > '//
> >
>
=======================================================
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > .
> > >
> > > [Non-text portions of this message have been
> > removed]
> > >
> > >
> > >
> > >
> > >
> > > '//
> >
>
=======================================================
> > >     Rules :
> > http://ReliableAnswers.com/List/Rules.asp
> > >     Home  :
> http://groups.yahoo.com/group/vbHelp/
> > >
> >
>
=======================================================
> > >     Post  : [EMAIL PROTECTED]
> > >     Join  : [EMAIL PROTECTED]
> 
=== message truncated ===



                
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to