+ Reply to Thread
Results 1 to 10 of 10

Change workbook connection from OLEDB to Database Query?

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Change workbook connection from OLEDB to Database Query?

    Using: MS-Excel 2007, and MS-SQL Server 2008

    From Excel: Data -> Connections -> [Choose the connection] -> Properties -> Definition

    The connection type is OLE DB Query, but it should be Database Query. I have no idea how this could have been changed, but I need to change it back, and I cannot figure out how.

    Any help appreciated, thanks in advance.

  2. #2
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Change workbook connection from OLEDB to Database Query?

    Under "Connection type" there is an entry for 'Connection string'. What does this entry have in it?

  3. #3
    Registered User
    Join Date
    01-04-2013
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Change workbook connection from OLEDB to Database Query?

    Quote Originally Posted by PingPing View Post
    Under "Connection type" there is an entry for 'Connection string'. What does this entry have in it?

    Thank you for responding.

    For security reasons, I cannot show everything. But it looks like this.

    Please Login or Register  to view this content.
    And this is completely wrong. It shold look more like this (again, some fields removed for security reasons):

    Please Login or Register  to view this content.

    Whenever I change the string to what it is supposed to be, the system changes it back.

  4. #4
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Change workbook connection from OLEDB to Database Query?

    The system appears to be forcing you to use OLEDB to connect to the MS SQL Server database. The Connection String that you say it should look like is an ODBC connection string.

    OLEDB and ODBC are two different Database APIs, ie. they are two different ways of connecting to the same Database and should give you the same result.

    Does your spreadsheet still work with the OLEDB connection being forced on you?

  5. #5
    Registered User
    Join Date
    01-04-2013
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Change workbook connection from OLEDB to Database Query?

    Quote Originally Posted by PingPing View Post
    The system appears to be forcing you to use OLEDB to connect to the MS SQL Server database. The Connection String that you say it should look like is an ODBC connection string.

    OLEDB and ODBC are two different Database APIs, ie. they are two different ways of connecting to the same Database and should give you the same result.

    Does your spreadsheet still work with the OLEDB connection being forced on you?

    No the spreadsheet does not work with the OLEDB connection. That is the whole problem. As I indicated in the subject line: I need to know how to change a workbook connection from OLEDB to Database Query.

    Thanks again for your reply.

  6. #6
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Change workbook connection from OLEDB to Database Query?

    It looks like the .dqy file has been either deleted or was never saved in the directory:

    WinXP - c:\documents and settings\<username>\application data\microsoft\queries
    Win7 - c:\users\<username>\AppData\roaming\microsoft\queries

    You will need either to:
    (a) locate the lost .dqy file;
    (b) recreate the .dqy file employing a text editor like Notepad;, or
    (c) go through the whole 'Get External Data' process again in Excel in order for the .dqy file to be recreated.

  7. #7
    Registered User
    Join Date
    01-04-2013
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Change workbook connection from OLEDB to Database Query?

    It is my understanding that I can connect to an ms-sql server with a connection string in the workbook - not a file.

    There are many pivot tables in the workbook. There are connect with workbook connection strings.

  8. #8
    Registered User
    Join Date
    01-04-2013
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Change workbook connection from OLEDB to Database Query?

    I am using Windows 7. There is nothing in this directory.

    Win7 - c:\users\<username>\AppData\roaming\microsoft\queries

    However, I have several pivot tables in my workbook which are working. I think the connection strings are in the workbook, not in external files.

  9. #9
    Forum Contributor
    Join Date
    08-18-2018
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    148

    Re: Change workbook connection from OLEDB to Database Query?

    I have the same problem. Any updates?

    I found out what should we do as an alternative. We need to create new connections thru Data, Existing connections, Browse for more and search for your database. This will create an connection, instead of query in excel.
    Last edited by dummy777; 09-25-2019 at 10:30 AM.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Change workbook connection from OLEDB to Database Query?

    Quote Originally Posted by dummy777 View Post
    I have the same problem. Any updates?

    I found out what should we do as an alternative. We need to create new connections thru Data, Existing connections, Browse for more and search for your database. This will create an connection, instead of query in excel.
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1