Access -> SQL Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcin Wasilewski

    #1

    Access -> SQL Server

    Hi,
    I have a probelm with connection to SQL from Access. I've seen same
    advices from you, but I steel have a problem.
    I need select some data form SQL Server using access's visual basic.
    Please give me a example (some pice of code).

    Thanks for help.

    mw

  • Marcin Wasilewski

    #2
    Re: Access -> SQL Server

    Now i'm using:
    Set cnnOLEDB_SQLSer ver = New ADODB.Connectio n
    gstrSQLServerNa me = "C-MWA"
    cnnOLEDB_SQLSer ver.Open "Provider=sqlol edb;" & _
    "Data Source=" & gstrSQLServerNa me & ";" & _
    "Initial Catalog=pubs;Us er Id = Test; " & _
    "Password=a aa;"

    but there is a error:
    "Login failed for user 'Test'. Reason: Not associated with a trusted
    SQL Server connection"

    I'm using windows user to authorize. The user is Test and password aaa.
    Am I change some permisions in data base or server?

    Comment

    • Anthony England

      #3
      Re: Access -> SQL Server

      "Marcin Wasilewski" <marcin.wasilew ski.mail@gmail. com> wrote in message
      news:1138284770 .317821.142160@ o13g2000cwo.goo glegroups.com.. .[color=blue]
      > Now i'm using:
      > Set cnnOLEDB_SQLSer ver = New ADODB.Connectio n
      > gstrSQLServerNa me = "C-MWA"
      > cnnOLEDB_SQLSer ver.Open "Provider=sqlol edb;" & _
      > "Data Source=" & gstrSQLServerNa me & ";" & _
      > "Initial Catalog=pubs;Us er Id = Test; " & _
      > "Password=a aa;"
      >
      > but there is a error:
      > "Login failed for user 'Test'. Reason: Not associated with a trusted
      > SQL Server connection"
      >
      > I'm using windows user to authorize. The user is Test and password aaa.
      > Am I change some permisions in data base or server?[/color]



      If you want to use a Windows account, then you do not give the username and
      password! That is the point. You have already logged on to Windows by
      giving these details once - so Windows knows who you are - and so the server
      can trust you. The connection string is set up like this:

      strConnection = "Provider=sqlol edb;" & _
      "Data Source=C-MWA;" & _
      "Initial Catalog=pubs;" & _
      "Integrated Security=SSPI"


      Comment

      • Marcin Wasilewski

        #4
        Re: Access -&gt; SQL Server

        >[color=blue]
        > If you want to use a Windows account, then you do not give the username and
        > password! That is the point. You have already logged on to Windows by
        > giving these details once - so Windows knows who you are - and so the server
        > can trust you. The connection string is set up like this:
        >
        > strConnection = "Provider=sqlol edb;" & _
        > "Data Source=C-MWA;" & _
        > "Initial Catalog=pubs;" & _
        > "Integrated Security=SSPI"[/color]

        Of course it works. Thank you very much. If it isn't a problem can you
        give me example if I need to connect with some server whih isn't on
        local computer. Of course I know IP adress, server name, ures and
        password name.

        Once again thank you.

        Marcin

        Comment

        Working...