Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLEDB and DBC Events and .NET Client Q
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
OLEDB and DBC Events and .NET Client Q
Divers
Thread ID:
00751201
Message ID:
00751201
Vues:
64
What is the recommended way to make sure a table environment is setup properly when a table is touched through a DBC via ADO.NET? My guess is that the dbc_AfterOpenTable event is running, but I want to make sure it is, since I have to ensure table buffering is on.

VFP code (located in a seperate events file)
		PROCEDURE dbc_AfterOpenTable(cTableName)
			Set Exclusive Off
			Set Multilocks On
			Set Deleted Off
			Set Collate To "MACHINE"
			Set Date to ANSI
			Set Century On
			Set Mark to "."
			Set Near On
			Set Exact Off
			Set Ansi Off
			isOK = CursorSetProp("Buffering",5,cTableName)
		ENDPROC
C# code for running a SP (which USEs a table and does some SQL and returns a string):
{
	string returnVal = "!default";
	OleDbConnection dataConn = new OleDbConnection();
	OleDbCommand dataCmd = new OleDbCommand();
	try
	{
		string connString = (ConfigurationSettings.AppSettings.Get("databaseLoc"));
		dataConn.ConnectionString = connString;
		dataConn.Open();
		dataCmd.Connection = dataConn;
		dataCmd.CommandText = "myStoredProc('" + parmName + "')";
		returnVal = dataCmd.ExecuteScalar().ToString();
	}
	catch (System.Data.OleDb.OleDbException xxx)
	{
		Trace.Write("Attempted dataCmd: " + dataCmd.CommandText);
		Trace.Warn(xxx.ToString());
		returnVal = "!err!DataAccess";
	}
	finally
	{
		dataCmd.Dispose();
		dataConn.Dispose();
	}
	return returnVal;
}
Thanks.
Répondre
Fil
Voir

Click here to load this message in the networking platform