Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Sharing Violation ofsdf file in PocketPC Expand / Collapse
Posted Wednesday, June 4, 2008 1:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 20, 2008 10:04 AM
Points: 1, Visits: 28
I’m working on an application written in C# in Compact Framework 2.0 for a Pocket PC. It is required that the application connects to the SQL CE database frequently. The sdf file is present in the PocketPC. Now I’m facing a problem now and then when the code tries to connect with the sdf file.

The code works fine for some time and then it suddenly starts throwing "There is a file sharing violation. A different process might be using the file."
I am disposing and closing the connection after each operation.
Please find the function code below which is being used for any database operation.

SqlCeConnection sqlCon = null;
sqlCon = ConnectionFactory.getInstance().getPrimDsConnection();
readCmd = sqlCon.CreateCommand();
dataReader = this.readCmd.ExecuteReader();
IList result = this.populateManyRows();
return result;
catch (SqlCeException sqlEx)
StringBuilder builder = new StringBuilder(
@"SqlCe Error in BaseReader.executeList() - ").Append(
throw new DataAccessException(sqlEx);
if( null != dataReader && ( !dataReader.IsClosed ))
if( null != readCmd) readCmd.Dispose();
if( null != sqlCon) sqlCon.Close();
catch (System.Exception ex)
I have also made sure that Query Analyzer is not running on my PDA.
Any help will be appreciated.

Many Thanks,
Post #511168
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse