none
Unhandled Exception: Operating System Error 32 RRS feed

  • Question

  • I'm using VS as admin, started project and got an unhandled exception at Connection.Open();

    Operating System error 32, Unable to open physical file 'filepath'.  The process could not access the file because it is being used by another process.  

    Cannot open user default database. Login Failed for user 'MicrosoftAccount\MyEmailAddress'  Restarted SQL Server, same problem.

    Took the 'if in doubt get the hell out' approach.  Closed everything, restarted my laptop.  opened VS as admin, refreshed database connections, clicked Start.  Same unhandled exception.

    Yet VS is the only application open/using the databases.  

    Anyone got any idea what the problem could be?  

    Monday, April 17, 2017 12:16 AM

Answers

  • As a last resort, I re-installed SQL server and VS.  What ever was causing this error seems to have been resolved as a result.  
    Wednesday, April 19, 2017 7:23 AM

All replies

  • Hi RichardDunneBSc

    Is full control! view link Unable to open the physical file Operating system error 32

    Regards!


    Si ayudé a resolver tu consulta, no olvides marcar como respuesta y/o votar como útil.

    Monday, April 17, 2017 12:30 AM
  • The only thing I can come up with is Sql server isn't seeing me as logged in to VS.  I've logged the issue in VS.  

    Monday, April 17, 2017 2:29 AM
  • Hi RichardDunneBSc,

    Based on your description, I'm not sure what cause the issue, could you please a bit more information, such as provide a simple demo. which I could reproduce the issue on my side.

    In addition, Please try to use using block to write your code. like this:

    using (SqlConnection conn = new SqlConnection(connStr))
                {
                    SqlCommand cmd = new SqlCommand("insert into tblbackuphistory values( @dateshamsi, @saat, @mas, @user)", conn);
                    cmd.Parameters.Add("@dateshamsi", SqlDbType.DateTime).Value = Convert.ToDateTime("2017-03-01");
                    //'guessing at column lengths here
                    cmd.Parameters.Add("@saat", SqlDbType.VarChar, 50).Value = "Test1";
                    cmd.Parameters.Add("@mas", SqlDbType.VarChar, 50).Value = "Test2";
                    cmd.Parameters.Add("@user", SqlDbType.NVarChar, 50).Value = "Test3";
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 19, 2017 6:31 AM
    Moderator
  • As a last resort, I re-installed SQL server and VS.  What ever was causing this error seems to have been resolved as a result.  
    Wednesday, April 19, 2017 7:23 AM
  • Hi RichardDunneBSc,

    I am glad to know that you resolve the issue and share the solution, it will be beneficial to other communities who have the similar issue.

    Best regards,

    Cole Wu


    MSDN Community Support<br/> Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.

    Tuesday, April 25, 2017 1:31 AM
    Moderator