none
Getting error: "Cannot open database "MainDB" requested by the login. The login failed. Login failed for user 'D630\Admin'."

    Question

  • Hi there

    I created a SQL DB named MainDB.mdf and a small VB 2010 application with some forms and datasets. Everything was working OK until i got a new computer and re-installed Visual Studio 2010 and SQL server 2010 on it.  I copied my DB from the old to the new computer and also copied by VB 2010 project to it.  I used Windows Authentication to connect to the DB in the old computer and also in the new one, i am using different Windows user account names though.

    I was able to connect to the DB in the new computer in the Server Explorer section, i created a new connection string to the DB and i can seed there is data in the tables.  When i run my VB 2010 application created in the old computer get error:  

    "Cannot open database "MainDB" requested by the login. The login failed. Login failed for user 'D630\Admin'."

    I need to get rid of that error and be able to add/mod/del data from my DB using my VB application as i used to.

    Thanks a lot, DonEd

    Thursday, March 15, 2012 12:57 AM

Answers

  • Seems you tell you used windows authentication but did not. 

    For windows authentication you need integrated security so a user and a password are not affected.

    Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

    Copied from 

    http://www.connectionstrings.com/sql-server-2008

    I did not know that SQL Server 2010 exist.

    :-) 


    Success
    Cor

    Friday, March 16, 2012 6:49 AM

All replies