-1
Dim SQLConnectionString As String = "Data Source=Computech-PC\SQLEXPRESS;Initial Catalog=Master;User ID=Administrator;Password=Admin", providerName1 = "System.Data.SqlClient"
4
  • When i run from code vb.net so no error run properly if after installation run exe file. error will be display Cannot open database "Script" requested by the login failed Login failed for user 'Cpmputech-PC\Cpmputech' Commented Sep 22, 2018 at 9:25
  • Just a curiosity? Error is coming cannot open database "Script" and you are requesting database "Master"! So please check in your code where you are calling anywhere "Script"! Secondly in comment you have mentioned user in error Computech-PC\Computech where as you are assigning user Administrator. So is your connection string firing same which declared or any other string is there? Finally test first in SQL Management Studio whether your login credentials are working fine? Commented Sep 22, 2018 at 12:15
  • Your connection is open to Master database. You are talking about Script database ? Does you administrator user have all privileges to access to Script database ? Open Management studio and access to Script database with logins you provided above just to be sure Commented Sep 22, 2018 at 13:45
  • The connection string has attributes that imply an OLEDB data provider connection string, yet it has this weird fragment providerName1 = "System.Data.SqlClient" that implies you are attempting to use the .Net Sql Server data provider. Also, your code fragment itself is not a valid string declaration. Show more of your code so that we can determine the context of what you are attempting. Commented Sep 22, 2018 at 14:47

1 Answer 1

0

You missed an important part in your connection string "Trusted_Connection=True" it will resolve your issue for "login failed" take a look at this thread Here, and i will suggest you a good connection string to use on your local machine and it will also help you if you want to deploy your application on another PCs

connectionString ="Data Source=computech-PC\SQLEXPRESS,1433;Network Library=DBMSSOCN;Initial Catalog=Master;Persist Security Info=True;User ID=admin;Password=password;Trusted_Connection=True;".

But you must take care about few things.....

1- Enabling Mixed Mode Authentication from Here

2- you must make an user on your SQL server that has a db_owner from Here and Here

3- configure firewall from Here and Here

4- You must review Here if you faced a problem "login failed"

5- an important hint about "login failed" from Hilary Cotter in msdn forum Here

and Finally you must see this magnificent thread deploy application with sql server database

I hope it helps...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.