Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speeding up query
Message
De
07/11/2002 11:53:19
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Speeding up query
Divers
Thread ID:
00719885
Message ID:
00719885
Vues:
53
I have created a C# form to access a VFP table on our network. The following is the code I am using to query this table. Everything works but the speed isn't that good. It takes about 2 seconds to return the result. The same query in VFP is immediate.

The oConn.Open(); and the oDataAdapter.Fill(oDataSet,"MyTable"); seem to take the longest to execute. Is there anything I can do to speed up this query? Or a different way to do this?
string strAccessConn = "Provider=VFPOLEDB.1;Data " + 
"Source=P:\\Mydir\\;Mode=ReadWrite|Share Deny None;Extended " +
"Properties=\"\";User ID=\"\";Password=\"\";Mask Password=False;Cache " +
"Authentication=False;Encrypt Password=False;Collating Sequence=MACHINE;DSN=\"\"";

string strAccessSelect = "SELECT * FROM MyTable WHERE MyField = '" + lcMyVar + "'";

DataSet oDataSet = new DataSet();
oDataSet.Tables.Add("MyTable");

OleDbConnection oConn = new OleDbConnection(strAccessConn);
OleDbCommand oAccessCommand = new OleDbCommand(strAccessSelect,oConn);
OleDbDataAdapter oDataAdapter = new OleDbDataAdapter(oAccessCommand);

oConn.Open();   //Slow here.
oDataAdapter.Fill(oDataSet,"MyTable"); //Slow here.
Thanks,

Jerry
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform