Results 1 to 5 of 5

Thread: [2005] SQL connection problems after using SQL Studio Express

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    [2005] SQL connection problems after using SQL Studio Express

    Hi,

    I created a one table DB using SQL Server Studio Express. I've been trying to learn this stuff and created a little app in .net just to display the items in a datagrid. It's all working fine.

    However, I've noticed a strange problem. If I open Studio Express and edit the database, save and close it (studio express). The when i try to re-connect to the DB through my .NET app it wont connect. It says:

    Cannot open user default database. Login failed.
    Login failed for user '####\####

    EDIT: I get the above error at the point of trying to open the connection:
    connAP.Open()

    I've added the # myself but you get the idea. If I restart my computer and just use .NET it connects as normal and works fine. As soon as i've used Studio Express it gives me the error. Any ideas??

    Here's my connection string in case it's important. As i say though i don't have problem connecting unless i use sql studio:
    vb Code:
    1. connAP.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=" & _
    2.        "C:\Temp\DB\jimmy.mdf" & _
    3.         ";Integrated Security=True;Connect Timeout=30;User Instance=True"
    Last edited by stimbo; Mar 22nd, 2007 at 10:29 AM.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  2. #2
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: [2005] SQL connection problems after using SQL Studio Express

    After making your change in SQL, refresh the connection string before running your application.

  3. #3

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] SQL connection problems after using SQL Studio Express

    It doesn't matter if I shut down .NET and start up the application again, it still wont work.

    The only thing that sorts it out is a reboot.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] SQL connection problems after using SQL Studio Express

    Why would you be using Management Studio Express to make changes anyway? You can make any changes you require in Visual Studio. I'm fairly certain that VB Express is the same.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] SQL connection problems after using SQL Studio Express

    I was using it because I was following tutorials etc... and it just seemed easier to use management studio because that's what they were in. I also wanted to use it because.... well I wanted to try it.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width