Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDB and DBC Events and .NET Client Q
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
OLEDB and DBC Events and .NET Client Q
Miscellaneous
Thread ID:
00751201
Message ID:
00751201
Views:
67
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.
Reply
Map
View

Click here to load this message in the networking platform