Proble with VB6 and SQL server
-
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 :)
-
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 :)
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.
-
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 :)
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
-
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 :)
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
-
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
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