Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO.NET and VFP TableBuffering Error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Titre:
ADO.NET and VFP TableBuffering Error
Divers
Thread ID:
00757408
Message ID:
00757408
Vues:
64
Using ADO.NET to talk to a VFP8 DBC through OLEDB with the following code (can't wait for the real command parameters with the release of VFP8!). I get the error
outSystem.Data.OleDb.OleDbException: Command cannot be issued within a transaction. at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(
tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.
OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.
OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& 
executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal
(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.
ExecuteNonQuery() at ...
I tracked it down to this DBC Event code:
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)	  && Breaks Here!
ENDPROC
It appears that ADO.NET (1) can't support VFP transactions and (2) can't support table buffering anyway.

HTH somebody.
{
OleDbConnection dataConn = new OleDbConnection();
OleDbCommand dataCmd = new OleDbCommand();
try
{
string connString = (ConfigurationSettings.AppSettings.Get("vfpdata1"));
dataConn.ConnectionString = connString;
dataConn.Open();
string ansiFormat = "yyyy.MM.dd HH:mm:ss";
DateTime tExp = (DateTime)dataTable.Rows[0]["tExpire"];
DateTime tCre = (DateTime)dataTable.Rows[0]["tCrDate"];
DateTime tUpd = (DateTime)dataTable.Rows[0]["tUpDate"];
DateTime tDel = (DateTime)dataTable.Rows[0]["tDelDate"];
string sql = 
" Update SecUser " +
" Set " + 
	" cUserId = '" + dataTable.Rows[0]["cUserId"] + "'" +
	" , cInfo = '" + dataTable.Rows[0]["cInfo"] +  "'" +
	" , cOrg = '" + dataTable.Rows[0]["cOrg"] +  "'" +
	" , tExpire = {^" + tExp.ToString( ansiFormat ) + "} " +
	" , tCrDate = {^" + tCre.ToString( ansiFormat ) +  "}" +
	" , cCrUser = '" + dataTable.Rows[0]["cCrUser"] +  "'" +
	" , tUpdate = {^" + tUpd.ToString( ansiFormat )+  "} " +
	" , cUpUser = '" + dataTable.Rows[0]["cUpUser"] +  "'" +
	" , tDelDate = {^" + tDel.ToString( ansiFormat ) +  "} " +
	" , cDelUser = '" + dataTable.Rows[0]["cDelUser"] +  "'" +
	" , iDel = " + dataTable.Rows[0]["iDel"] + 
	" Where iID = " + dataTable.Rows[0]["iID"];
dataCmd.Connection = dataConn;
dataCmd.CommandText = "SET NULL OFF\r\nSET DELETED ON\r\nSET DATE TO ANSI\r\nSET MARK TO '.'";
dataCmd.ExecuteNonQuery();
dataCmd.CommandText = sql;
this.httpContext.Response.Write(dataCmd.CommandText+"<br/>");
dataCmd.ExecuteNonQuery();
}
catch (System.Data.OleDb.OleDbException xxx)
{
this.httpContext.Response.Write(xxx.ToString());
}
finally
{
if ( dataConn != null)
{
	dataConn.Dispose();
}
}
Répondre
Fil
Voir

Click here to load this message in the networking platform