Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

file is already opened exclusively by another user, or you need permission to view its data.

$
0
0

 It is already opened exclusively by another user, or you need permission to view its data.

private void CreateDBFFile()
{
    string connection = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;

    using (OleDbConnection dbconnection = new OleDbConnection(connection))
    using (OleDbCommand command = dbconnection.CreateCommand())
    {
        dbconnection.Open();

        command.CommandText = "CREATE TABLE Test (Id Integer, Changed Double, Name Text)";
        command.ExecuteNonQuery();
    }
}

My web.config file has connection string

<connectionStrings><add name="conn"
       connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=k:\temp1"
       providerName="System.Data.OleDb" /></connectionStrings>

I am trying to create a dbf file on my K drive. I keep getting an error on my dbConnection.Open() statement saying:

The Microsoft Jet database engine cannot open the file 'k:\temp1'. It is already opened exclusively by another user, or you need permission to view its data.

K:\ is not a mapped drive. I gave network service userName to temp1 folder by going under security tab. I also gave modify rights to the Network service. Still keep getting this error. I also tried to put the entire above code in console application, that didn't work either. I keep getting the same error.

Any help will be greatly appreciated.


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>