VB6: Cannot change connection provider for Data Environment connection
Posted on 2003-10-23
VB6 program has a Data Environment with an ADO connection "conArchive". In VB6 development environment, the provider is set to "Microsoft Jet 4.0 OLE DB Provider" along with an .mdb Data Source file.
When the program starts, it may need to change to a SQL database provider with this code:
If DeApcoErs.conArchive.State <> adStateClosed Then
DeApcoErs.conArchive.Provider = "Microsoft OLE DB Provider for SQL Server;"
which causes this error: "Supplied provider is different from the one already in use."
Trying to set the connection string to a SQL provider, source, etc. also causes and error: "multiple step error...".