none
Having a little problem, ADO issue. RRS feed

  • Question

  •  

    Alright, first of all, not sure if I am posting in the right forum or not, but have to begin somewhere.  I have created an ASP.NET based workorder/project management system utilizing a sqlexpress database.  I have also created a simple windows form, that initiates a connection to the database, and checks for new workorders, notifying users of a new workorder being added.  The problem I am experiencing, is that database seems to be "locked" or read-only, I beleive this is being caused by the user "NT AUTHORITY\NETWORK SERVICE" haveing exclusive access to the database, however I am no expert, and could certianly use some further "guidance".  here is a snippet of code for my connection string being utilized within the windows form -

     

    SqlConnection dbConn = null;

    SqlCommand connCmd = null;

    SqlDataReader dataReader = null;

    SqlParameter param = new SqlParameter();

    param.ParameterName = "@read";

    param.Value = Read;

    string strConn = null;

    string strSQL = "SELECT TOP 1 IDWorkOrder FROM ISWWorkOrders WITH(NOLOCK) WHERE [Read] = @Read";

    strConn = "Network Library=DBMSSOCN;" +

    "Data Source=(omitted)\\(omitted);" +

    "Initial Catalog=ISWeb;" +

    "User ID=(omitted);" +

    "Password=(omitted)";

    dbConn = new SqlConnection(strConn);

    dbConn.ConnectionString = strConn;

    dbConn.Open();

    connCmd = new SqlCommand(strSQL, dbConn);

    connCmd.Parameters.Add(param);

    dataReader = connCmd.ExecuteReader();

     

    Thanks in advance for the help.

     

    -Lukin

    Friday, January 4, 2008 5:05 PM

Answers

  •  

    Alright, I was able to fix this quite easily.  Ill' show you what I did.  The connection string in my ASP.net app was accessing my DB exclusivley, I changed this by taking out "|AttachDbFilname|"mydb"; User Instance=True" and changing it to "Initial Catalog=mydb; Integrated security=True".  Therefore, now instead of "Attaching the db exclusively, it just opens it.

     

    thanks for the help, if anyone else is having a similar proble, I can go more in depth into the solution, just let me know.

     

    Lukin

    Friday, January 4, 2008 6:53 PM

All replies

  • Can you post the error you're receiving? Is it happening in the asp.net app or the windows app?

     

    Also, I think you can omit that Network Library=DBMSSOCN line. I never use it anyway.

     

    Friday, January 4, 2008 5:57 PM
  • Thanks for the reply.  It is happening in the windows app, the error is as follows:

     

    Unable to open the physical file (mydatabase-name-omitted) Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".

     

    seems as if it is being made read only by the asp connection, AND vice versa, because, when I restart sqlserver services, it unlocks the database, allowing me to use the windows app OR the webapp, but not both simultaneously....frustrating...

     

    thanks for the help.

     

    Lukin

    Friday, January 4, 2008 6:25 PM
  •  

    Alright, I was able to fix this quite easily.  Ill' show you what I did.  The connection string in my ASP.net app was accessing my DB exclusivley, I changed this by taking out "|AttachDbFilname|"mydb"; User Instance=True" and changing it to "Initial Catalog=mydb; Integrated security=True".  Therefore, now instead of "Attaching the db exclusively, it just opens it.

     

    thanks for the help, if anyone else is having a similar proble, I can go more in depth into the solution, just let me know.

     

    Lukin

    Friday, January 4, 2008 6:53 PM