SqlCeTransactionInProgressException Class
Si verifica quando si cerca di modificare un database mentre è in corso un'altra transazione.
Spazio dei nomi: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
Sintassi
'Dichiarazione
Public Class SqlCeTransactionInProgressException
Inherits SqlCeException
public class SqlCeTransactionInProgressException : SqlCeException
public ref class SqlCeTransactionInProgressException : public SqlCeException
public class SqlCeTransactionInProgressException extends SqlCeException
public class SqlCeTransactionInProgressException extends SqlCeException
Gerarchia di ereditarietà
System.Object
System.Exception
System.SystemException
System.Data.SqlServerCe.SqlCeException
System.Data.SqlServerCe.SqlCeTransactionInProgressException
Esempio
Dim timeout As New TimeSpan(0, 0, 15) 'hours, minutes, seconds
Dim startTime As DateTime = DateTime.Now
While DateTime.Now - startTime < timeout
Try
Dim repl As New SqlCeReplication()
repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll"
repl.Publisher = "myPublisher"
repl.PublisherDatabase = "AdventureWorks"
repl.PublisherSecurityMode = SecurityType.NTAuthentication
repl.Publication = "AdventureWorks"
repl.Subscriber = "Test"
repl.SubscriberConnectionString = "Data Source='MyDatabase.sdf';Password='';"
repl.Synchronize()
Catch exInProgress As SqlCeTransactionInProgressException
Thread.Sleep(3000)
GoTo ContinueWhile1
Catch exTimeout As SqlCeLockTimeoutException
' Add your own error-handling logic here
GoTo ContinueWhile1
Catch e As SqlCeException
MessageBox.Show(e.Message)
End Try
ContinueWhile1:
End While
TimeSpan timeout = new TimeSpan(0 /*hours*/, 0 /* minutes */ , 15 /*seconds*/);
DateTime startTime = DateTime.Now;
while (DateTime.Now - startTime < timeout)
{
try
{
SqlCeReplication repl = new SqlCeReplication();
repl.InternetUrl = "https://www.adventure-works.com/sqlmobile/sqlcesa35.dll";
repl.Publisher = "myPublisher";
repl.PublisherDatabase = "AdventureWorks";
repl.PublisherSecurityMode = SecurityType.NTAuthentication;
repl.Publication = "AdventureWorks";
repl.Subscriber = "Test";
repl.SubscriberConnectionString = "Data Source='MyDatabase.sdf';Password='';";
repl.Synchronize();
}
catch (SqlCeTransactionInProgressException)
{
Thread.Sleep(3000);
continue;
}
catch (SqlCeLockTimeoutException)
{
//add your own error-handling logic here
}
catch (SqlCeException e)
{
MessageBox.Show(e.Message);
}
}
Affidabilità
Tutti i membri statici pubblici (Shared in Microsoft Visual Basic) di questo tipo sono affidabili. Non è invece garantita l'affidabilità dei membri dell'istanza.
Piattaforme
Piattaforme di sviluppo
Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
Informazioni sulla versione
.NET Framework e .NET Compact Framework
Supportato in 3.5
.NET Framework
Supportato in 3.0
.NET Compact Framework e .NET Framework
Supportato in 2.0
Vedere anche
Riferimento
SqlCeTransactionInProgressException Members
System.Data.SqlServerCe Namespace