+ Reply to Thread
Results 1 to 2 of 2

Database Connection

  1. #1
    Phil
    Guest

    Database Connection

    Hi,

    I am currently testing different ways that I can connect my SQL Server
    Database to my Excel Sheet and I just wanted to know if there are any real
    advantages to either, at first I was trying the below connection string in VB
    in my Excel Sheet -:

    "ODBC;DSN=NameOfDSN;UID=UserName;pword=PASSWORDAPP=Microsoft®
    Query;WSID=SERVER;DATABASE=DATABASE;Network=DBMSSOCN;Trusted_Connection=Yes" _

    Now if I have my logic right which I might not do :-) this has to have a
    ODBC connection set up through control pannel to work.

    The other connection string is -:

    "ODBC;Driver={SQL
    Server};Server=SERVER;Database=DATABASE;WSID=WorkStationID;UID=UserName;pword=PASSWORDAPP=Microsoft® Query;Network=DBMSSOCN;Trusted_Connection=Yes" _

    This string sets up all the connection attributes through the VB without
    having to use Control Pannel.

    Are my assumptions with both of these connections correct and if so for some
    reason I get a different output from the second string connection, for some
    reason it will return my table headings in the SQL Database but no data, but
    if it is run a couple of times it suddenly starts to work, I though I was
    slowly getting the grasp of all this but it appears not.

    Any help that is offered would be much appreciated.

    Regards
    Philip

  2. #2
    Jake Marx
    Guest

    Re: Database Connection

    Hi Phil,

    If you're using ADO to connect to SQL Server, I suggest using an OLEDB
    connection string. More info here:

    http://msdn.microsoft.com/library/de...qlprovspec.asp

    --
    Regards,

    Jake Marx
    MS MVP - Excel
    www.longhead.com

    [please keep replies in the newsgroup - email address unmonitored]


    Phil wrote:
    > Hi,
    >
    > I am currently testing different ways that I can connect my SQL Server
    > Database to my Excel Sheet and I just wanted to know if there are any
    > real
    > advantages to either, at first I was trying the below connection
    > string in VB
    > in my Excel Sheet -:
    >
    > "ODBC;DSN=NameOfDSN;UID=UserName;pword=PASSWORDAPP=Microsoft®
    > Query;WSID=SERVER;DATABASE=DATABASE;Network=DBMSSOCN;Trusted_Connection=Yes"
    > _
    >
    > Now if I have my logic right which I might not do :-) this has to
    > have a
    > ODBC connection set up through control pannel to work.
    >
    > The other connection string is -:
    >
    > "ODBC;Driver={SQL
    > Server};Server=SERVER;Database=DATABASE;WSID=WorkStationID;UID=UserName;pword=PASSWORDAPP=Microsoft®
    > Query;Network=DBMSSOCN;Trusted_Connection=Yes" _
    >
    > This string sets up all the connection attributes through the VB
    > without
    > having to use Control Pannel.
    >
    > Are my assumptions with both of these connections correct and if so
    > for some
    > reason I get a different output from the second string connection,
    > for some
    > reason it will return my table headings in the SQL Database but no
    > data, but
    > if it is run a couple of times it suddenly starts to work, I though I
    > was
    > slowly getting the grasp of all this but it appears not.
    >
    > Any help that is offered would be much appreciated.
    >
    > Regards
    > Philip



+ 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