Welcome, Guest. Please Login.
04/18/24 at 11:48:51
News:
Home Help Search Login


Pages: 1
Send Topic Print
Is there an easy way to update ODBC connections. . (Read 1226 times)
TGerak
Full Member
***


DBA Classic Since
2000!

Posts: 186
Is there an easy way to update ODBC connections. .
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?
Back to top
 
 
  IP Logged
Kelloggs
Active Member
*****


Do crazy people know
they are crazy?

Posts: 785
Gender: male
Re: Is there an easy way to update ODBC connection
Reply #1 - 09/30/14 at 14:46:39
 
Cristal Report? MS Access?
 
 Huh
 
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")
Back to top
 
 

Evo ERP - 35 Users
Dumped MS Access like a hot potato (VB.Net rules!!!)
Email WWW   IP Logged
Pages: 1
Send Topic Print