0

I am using C#.NET Application. Having One Query which Executed With OldDbProvider.

System.Data.OleDb.OleDbConnection oleCon = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + textBox1.Text + ";");
        try
        {
            DateTime dt = DateTime.Now;
            oleCon.Open();


            string emtypeVerificationQry = "SELECT Top 1 [FieldName] FROM [TableName]";

            System.Data.OleDb.OleDbCommand oleCommand = new System.Data.OleDb.OleDbCommand();
            oleCommand.CommandText = emtypeVerificationQry;
            oleCommand.Connection = oleCon;

            object objectRest = oleCommand.ExecuteScalar();

}

I am facing Problem with this Query: Same Query Executed In machine which have local .mdb file location. If .mdb file located at UNC/Network Location It takes much time to execute same query and some time it gives Error While Executing Query.

Does any one have resolution of this issue?

Thanks

Dhaval Patel
  • 7,471
  • 6
  • 37
  • 70
  • What is the error you get exactly? – Soner Gönül Jul 14 '14 at 05:54
  • May be a dns issue? Thats what normally "hangs" in the background... but then evnetually goes through... what is your unc path, have you tried using an ip address instead of a hostname? – Louis van Tonder Jul 14 '14 at 07:29
  • Error Is : Can not execute Query.. I tried with UNC Path like '\MachineName\Drive' And With IP Address "\IPAddress\Drive" both gives same result, same query takes 4 min on UNC and second to execute in local mdb file. – user2071694 Jul 15 '14 at 09:11

0 Answers0