SqlCeLockTimeoutException Class
This exception is thrown if the lock timeout has been reached.
Inheritance Hierarchy
System.Object
System.Exception
System.SystemException
System.Runtime.InteropServices.ExternalException
System.Data.Common.DbException
System.Data.SqlServerCe.SqlCeException
System.Data.SqlServerCe.SqlCeLockTimeoutException
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)
Syntax
'Declaration
<SerializableAttribute> _
Public Class SqlCeLockTimeoutException _
Inherits SqlCeException
'Usage
Dim instance As SqlCeLockTimeoutException
[SerializableAttribute]
public class SqlCeLockTimeoutException : SqlCeException
[SerializableAttribute]
public ref class SqlCeLockTimeoutException : public SqlCeException
[<SerializableAttribute>]
type SqlCeLockTimeoutException =
class
inherit SqlCeException
end
public class SqlCeLockTimeoutException extends SqlCeException
The SqlCeLockTimeoutException type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SqlCeLockTimeoutException | Constructor that helps in serialization. |
Top
Properties
Name | Description | |
---|---|---|
Data | (inherited from Exception) | |
ErrorCode | (inherited from ExternalException) | |
Errors | Gets a collection of one or more SqlCeError objects that contain detailed information about exceptions generated by the .NET Compact Framework Data Provider for SQL Server Compact. (inherited from SqlCeException) | |
HelpLink | (inherited from Exception) | |
HResult | Gets the HRESULT value of the exception. This value is the same as the value of HResult for the first instance of SqlCeError in the SqlCeErrorCollection for the exception. (inherited from SqlCeException) | |
InnerException | (inherited from Exception) | |
Message | Gets the text describing the first instance of SqlCeError in the SqlCeErrorCollection for this exception. (inherited from SqlCeException) | |
NativeError | Gets the native error number of the first SqlCeError in the SqlCeErrorCollection. For more information about the error, see the "SQL Server Compact Errors" topic in the Troubleshooting section of SQL Server Compact Books Online. (inherited from SqlCeException) | |
Source | Gets the name of the OLE DB provider that generated the error. (inherited from SqlCeException) | |
StackTrace | (inherited from Exception) | |
TargetSite | (inherited from Exception) |
Top
Methods
Name | Description | |
---|---|---|
Equals | (inherited from Object) | |
Finalize | (inherited from Object) | |
GetBaseException | (inherited from Exception) | |
GetHashCode | (inherited from Object) | |
GetObjectData | Security Critical. Populates a SerializationInfo with the data needed to serialize the object. (Overrides SqlCeException.GetObjectData(SerializationInfo, StreamingContext).) | |
GetType | (inherited from Exception) | |
MemberwiseClone | (inherited from Object) | |
ToString | (inherited from Exception) |
Top
Remarks
For more information, see the topic "Locking (SQL Server Compact)" in the SQL Server Compact Books Online.
Examples
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);
}
}
Thread Safety
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.