Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SqlCeLockTimeoutException Class

This exception is thrown if the lock timeout has been reached.

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)
[SerializableAttribute]
public class SqlCeLockTimeoutException : SqlCeException

The SqlCeLockTimeoutException type exposes the following members.

  NameDescription
Protected methodSqlCeLockTimeoutExceptionConstructor that helps in serialization.
Top
  NameDescription
Public propertyData (inherited from Exception)
Public propertyErrorCode (inherited from ExternalException)
Public propertyErrorsGets 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)
Public propertyHelpLink (inherited from Exception)
Public propertyHResultGets 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)
Public propertyInnerException (inherited from Exception)
Public propertyMessageGets the text describing the first instance of SqlCeError in the SqlCeErrorCollection for this exception. (inherited from SqlCeException)
Public propertyNativeErrorGets 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)
Public propertySourceGets the name of the OLE DB provider that generated the error. (inherited from SqlCeException)
Public propertyStackTrace (inherited from Exception)
Public propertyTargetSite (inherited from Exception)
Top
  NameDescription
Public methodEquals (inherited from Object)
Protected methodFinalize (inherited from Object)
Public methodGetBaseException (inherited from Exception)
Public methodGetHashCode (inherited from Object)
Public methodGetObjectDataSecurity Critical. Populates a SerializationInfo with the data needed to serialize the object. (Overrides SqlCeException.GetObjectData(SerializationInfo, StreamingContext).)
Public methodGetType (inherited from Exception)
Protected methodMemberwiseClone (inherited from Object)
Public methodToString (inherited from Exception)
Top

For more information, see the topic "Locking (SQL Server Compact)" in the SQL Server Compact Books Online.

        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 = "http://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);
            }
        }


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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.