locked
Can not connect to my database RRS feed

  • Question

  • I have a database located at C:\Databases\myDatabase.mdf

     

    I can connect to myDatabase.mdf with C# Express just fine but can not connect to it through SQL Server Management Studio. When I run SQL Server 2008 the only databases available are System Databases - master, model, msdb , and tempdb.

     

    Any ideas on how to get to my database? I tried to move a copy of it to C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA which is where the system databases seem to be but still no luck.

     

    Any ideas? Thanks in advance.

    Monday, January 10, 2011 8:39 AM

Answers

  • Hi,

     

    First do Attach database with your Database engine and then try to do further things.

    For attach .mdf file.

    Login in to Database engine thru SSMS.

    then right click the database and select Attach.

    From which you need to select the .mdf file and click attach


    RM Thirunavukkarasu MCP, MCITP, ITIL V3 |Click "Propose As Answer" if solution is helpful to you|http://thiruna.blog.com. Thiru - MS SQL World
    • Marked as answer by kjpell Tuesday, January 11, 2011 10:32 AM
    Monday, January 10, 2011 9:02 AM

All replies

  • From C# Express how do you connect? What is your connection string? Are you connecting to the server via Management Studio using the same account you are using from your C# application? Connecting the file itself (the .mdf file) is not connecting to the database, you attach the .mdf file to SQL Server and then access the database via a connection to SQL Server.

     

    Thanks


    /Neil Moorthy - Senior SQL Server DBA/Developer (MCITP (2005), MCAD, OCA 11g) Please click the Mark as Answer button if a post solves your problem
    Monday, January 10, 2011 8:49 AM
  • Hi,

     

    First do Attach database with your Database engine and then try to do further things.

    For attach .mdf file.

    Login in to Database engine thru SSMS.

    then right click the database and select Attach.

    From which you need to select the .mdf file and click attach


    RM Thirunavukkarasu MCP, MCITP, ITIL V3 |Click "Propose As Answer" if solution is helpful to you|http://thiruna.blog.com. Thiru - MS SQL World
    • Marked as answer by kjpell Tuesday, January 11, 2011 10:32 AM
    Monday, January 10, 2011 9:02 AM
  • My connection string in C# Express is "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Databases\\myDataBase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";

    Under Management Studio I choose database engine as server type, server name is MYHP\SQLEXPRESS, and windows authentication. I only get the System Databases when I do that.

    Thanks again.

    Monday, January 10, 2011 10:47 AM
  • Hi,

     

    First do Attach database with your Database engine and then try to do further things.

    For attach .mdf file.

    Login in to Database engine thru SSMS.

    then right click the database and select Attach.

    Thank you. Will I have to do this every time I open Management Studio or just the one time?
    Monday, January 10, 2011 10:51 AM
  • Hi,

    Just one time its enough. .

    .


    RM Thirunavukkarasu MCP, MCITP, ITIL V3 |Click "Propose As Answer" if solution is helpful to you|http://thiruna.blog.com. Thiru - MS SQL World
    Tuesday, January 11, 2011 4:17 AM