SqlCeConnection works slowly sometimes RRS feed

  • Question

  • SqlCeConnection connection = new SqlCeConnection(connectionString);

    sometimes program waiting in this line about 10 seconds

    This is my connection string:

    @"Data Source=" + File.ReadAllText(@"DBAdr.txt") + @";Password=hayk"

    What is problem???

    My SDF file in 4.0.8876.1 version, program .NET 3.5 client profile, PC Windows 7 x86

    • Moved by Fred Bao Thursday, July 9, 2015 1:50 AM ADO.NET Related
    Tuesday, June 23, 2015 12:51 PM

All replies

  • If this is a multi-threaded application, the app may face a deadlock scenario while reading the file. Please check it's waiting on creating connection or just reading the file? It's always advisable to have connection string in config file i.e. app.config or web.config.

    You can simply check using connection string as simple string whether it's waiting or not.

    Anirban Bhattacharya

    Tuesday, June 23, 2015 1:50 PM
  • reading file is normall. it is going at first on program and doing only one time.

    then when i want to connect with db i have using this line

    SqlCeConnection connection = new SqlCeConnection(connectionString);

    and in this line SOMETIMES (not every time) program waiting about 10 seconds,(i have checked it in debug mode)

    but there are no this problem on all PC s , i have win8 works normally have win7 works normally, but there are 2 pcs with win7 work UNNORMAL

    Tuesday, June 23, 2015 6:58 PM
  • Can you please use Performance Monitor on those two PCs. If it's running perfectly on two PCs then there is no error in your code. It looks like those two PC is facing serious I/O problem.

    Simply checking the disk activity on those two PC may give you the answer. If the disk activity is over 80%, those computers will behave abnormal. Also please check the page faults there as well.

    Waiting for your test results.

    Anirban Bhattacharya

    Wednesday, June 24, 2015 4:48 AM