Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Proble with VB6 and SQL server

Proble with VB6 and SQL server

Scheduled Pinned Locked Moved Visual Basic
helpdatabasetutorialsql-server
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gamerPotatoe
    wrote on last edited by
    #1

    Hi guys I'm making a simple program in VB and thi is like one of my first attempts at using VB6 with SQL Server 2000. I've made a simple database in Sql server and a simple front end in VB6. I'm following a tutorial and the problem is that I get this error everytime I try to run my code. Run time error '-2147467259' (80004005) Login failed for user [Windows Login]. Reason Not associated with a trusted SQL Server COnnection The code is the first simple just creating a simple connection object code.. Private Sub Command1_Click() Dim dbConnection As New ADODB.Connection dbConnection.ConnectionString = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=FC_AIRLINES" dbConnection.Open UserID,Pww 'UserID and Pww are my USerID and Pww If dbConnection.State = adStateOpen Then MsgBox ("CONNECTION OPEN SUCCESSFUL") Else MsgBox ("CONNECTION FAILED") End If dbConnection.Close End Sub I think theres some work tobe done at my SQL server databse end, but I have no idea what to do and how to do it :). Its driving me nutz , I could use any help on what could be wrong guys :)

    J S 3 Replies Last reply
    0
    • G gamerPotatoe

      Hi guys I'm making a simple program in VB and thi is like one of my first attempts at using VB6 with SQL Server 2000. I've made a simple database in Sql server and a simple front end in VB6. I'm following a tutorial and the problem is that I get this error everytime I try to run my code. Run time error '-2147467259' (80004005) Login failed for user [Windows Login]. Reason Not associated with a trusted SQL Server COnnection The code is the first simple just creating a simple connection object code.. Private Sub Command1_Click() Dim dbConnection As New ADODB.Connection dbConnection.ConnectionString = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=FC_AIRLINES" dbConnection.Open UserID,Pww 'UserID and Pww are my USerID and Pww If dbConnection.State = adStateOpen Then MsgBox ("CONNECTION OPEN SUCCESSFUL") Else MsgBox ("CONNECTION FAILED") End If dbConnection.Close End Sub I think theres some work tobe done at my SQL server databse end, but I have no idea what to do and how to do it :). Its driving me nutz , I could use any help on what could be wrong guys :)

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      There are two ways to authenticate to a SQL Database: 1) Windows NT/2000 Integrated Authentication and 2) SQL Server Authentication. In the first scenario, your NT/2000 account has to be added to the Security Users/Logins and granted permissions to the database at a level at which you can read from the database. In the second scenario, you create a SQL Server account and grant that account permission to the database. In the first scenario, if you are logged in as yourself, you do not have to enter any user name and password, but the connection string should reflect that you are using integrated security. In the second scenario, you can include the user name and password in the connection string. Check MSDN for more details.

      1 Reply Last reply
      0
      • G gamerPotatoe

        Hi guys I'm making a simple program in VB and thi is like one of my first attempts at using VB6 with SQL Server 2000. I've made a simple database in Sql server and a simple front end in VB6. I'm following a tutorial and the problem is that I get this error everytime I try to run my code. Run time error '-2147467259' (80004005) Login failed for user [Windows Login]. Reason Not associated with a trusted SQL Server COnnection The code is the first simple just creating a simple connection object code.. Private Sub Command1_Click() Dim dbConnection As New ADODB.Connection dbConnection.ConnectionString = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=FC_AIRLINES" dbConnection.Open UserID,Pww 'UserID and Pww are my USerID and Pww If dbConnection.State = adStateOpen Then MsgBox ("CONNECTION OPEN SUCCESSFUL") Else MsgBox ("CONNECTION FAILED") End If dbConnection.Close End Sub I think theres some work tobe done at my SQL server databse end, but I have no idea what to do and how to do it :). Its driving me nutz , I could use any help on what could be wrong guys :)

        S Offline
        S Offline
        steff kamush
        wrote on last edited by
        #3

        methinks your connectionstring is wrong. try dbConnection.ConnectionString = "UID=UserID;PWD=Pww;Provider=MSDATASHAPE;Data Source=SQLOLEDB;Initial Catalog=FC_AIRLINES;Server=yourserver" dbConnection.Open The server is the PC hosting the database. If running on local PC then put PC local name or leave it out. :rose::rose: 1fm1fu

        1 Reply Last reply
        0
        • G gamerPotatoe

          Hi guys I'm making a simple program in VB and thi is like one of my first attempts at using VB6 with SQL Server 2000. I've made a simple database in Sql server and a simple front end in VB6. I'm following a tutorial and the problem is that I get this error everytime I try to run my code. Run time error '-2147467259' (80004005) Login failed for user [Windows Login]. Reason Not associated with a trusted SQL Server COnnection The code is the first simple just creating a simple connection object code.. Private Sub Command1_Click() Dim dbConnection As New ADODB.Connection dbConnection.ConnectionString = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=FC_AIRLINES" dbConnection.Open UserID,Pww 'UserID and Pww are my USerID and Pww If dbConnection.State = adStateOpen Then MsgBox ("CONNECTION OPEN SUCCESSFUL") Else MsgBox ("CONNECTION FAILED") End If dbConnection.Close End Sub I think theres some work tobe done at my SQL server databse end, but I have no idea what to do and how to do it :). Its driving me nutz , I could use any help on what could be wrong guys :)

          S Offline
          S Offline
          steff kamush
          wrote on last edited by
          #4

          methinks your connectionstring is wrong. try dbConnection.ConnectionString = "UID=UserID;PWD=Pww;Provider=MSDATASHAPE;Data Source=SQLOLEDB;Initial Catalog=FC_AIRLINES;Server=yourserver" dbConnection.Open The server is the PC hosting the database. If running on local PC then put PC local name or leave it out. :rose::rose: 1fm1fu

          S 1 Reply Last reply
          0
          • S steff kamush

            methinks your connectionstring is wrong. try dbConnection.ConnectionString = "UID=UserID;PWD=Pww;Provider=MSDATASHAPE;Data Source=SQLOLEDB;Initial Catalog=FC_AIRLINES;Server=yourserver" dbConnection.Open The server is the PC hosting the database. If running on local PC then put PC local name or leave it out. :rose::rose: 1fm1fu

            S Offline
            S Offline
            steff kamush
            wrote on last edited by
            #5

            i meant u try dbConnection.ConnectionString = "UID=UserID; PWD=Pww; Provider=MSDATASHAPE;Data Source=SQLOLEDB;Initial Catalog=FC_AIRLINES;Server=yourserver" dbConnection.Open n don smile when doin it! :rose::rose: 1fm1fu

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups