ISTech Support Forum
http://www.istechforum.com/YaBB.pl
Crystal Reports, ODBC & Access >> ODBC General Issues >> Is there an easy way to update ODBC connections. .
http://www.istechforum.com/YaBB.pl?num=1412100401

Message started by TGerak on 09/30/14 at 11:06:41

Title: Is there an easy way to update ODBC connections. .
Post by TGerak on 09/30/14 at 11:06:41

after a server migration?  I was able to set up the engine on the new server and set up the new System Data Source.  I can also create new queries to the new server, but any queries set up using the old server are broken.  I've edited the old queries to point to the new server/data source but I get errors including a Btrieve Error 2301.

Anyone found an easy way to convert them?

Title: Re: Is there an easy way to update ODBC connection
Post by Kelloggs on 09/30/14 at 14:46:39

Cristal Report? MS Access?

:-?

Kelloggs

If in ms access  you can do it by code:

Function CreateSPT (SPTQueryName As String, SQLString As String, ConnectString As String)
     '-----------------------------------------------
     ' FUNCTION: CreateSPT()
     ' PURPOSE:
     '   Creates an SQL pass-through query using the supplied arguments:
     '      SPTQueryName: the name of the query to create
     '      SQLString: the query's SQL string
     '      ConnectString: the ODBC connect string, this must be at
     '         least "ODBC;"
     '-----------------------------------------------
        Dim mydatabase As Database, myquerydef As QueryDef

        Set mydatabase = DBENGINE.Workspaces(0).Databases(0)
        Set myquerydef = mydatabase.CreateQueryDef(SPTQueryName)

        myquerydef.connect = ConnectString
        myquerydef.sql = SQLString
        myquerydef.Close

End Function

the way to use the function is like this:

CreateSPT("Test", "Select * from authors", "ODBC;DSN=Red;Database=Pubs;USID=JOE;PWD=JOE")

ISTech Support Forum » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.