Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Deutsch) » MobiLink - Clientadministration » SQL Anywhere-Clients für MobiLink » Dbmlsync-API

 

Dbmlsync-API für .NET

Dieser Abschnitt beschreibt die Methoden in der .NET-Implementierung der DbmlsyncClient-Klasse.

Das untenstehende Beispiel zeigt eine typische Anwendung, indem die C++-Version der Dbmlsync-API verwendet wird, um eine Synchronisation zum Empfang von Ausgabeereignissen durchzuführen. Aus Gründen der Einfachheit wird die Fehlerbehandlung weggelassen. Es ist immer empfehlenswert, den Rückgabewert von jedem API-Aufruf zu überprüfen.

Dbmlsync .Net-Beispiel
using System;
using System.Collections.Generic;
using System.Text;
using iAnywhere.MobiLink.Client;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            DbmlsyncClient cli1;
            DBSC_StartType st1;
            DBSC_Event ev1;
            UInt32 syncHdl;

            cli1 = DbmlsyncClient.InstantiateClient();
            cli1.Init();

            // Setting the "server path" is usually required on Windows
            // Mobile/CE. In other environments the server path is usually 
            // not required unless you SA install is not in your path or
            // you have multiple versions of the product installed
            cli1.SetProperty("server path", "d:\\sybase\\asa1100r\\bin32");

            cli1.StartServer(3426, 
             "-c eng=cons;dbn=rem1;uid=dba;pwd=sql -ve+ -ot c:\\dbsync1.txt", 
             5000, out st1);
            cli1.Connect(null, 3426, "dba", "sql");
            syncHdl = cli1.Sync("sp1", "");
            while (cli1.GetEvent(out ev1, 5000) 
                      == DBSC_GetEventRet.DBSC_GETEVENT_OK)
            {
                if (ev1.hdl == syncHdl)
                {
                    Console.WriteLine("Event Type : {0}", ev1.type);
                    if (ev1.type == DBSC_EventType.DBSC_EVENTTYPE_INFO_MSG)
                    {
                        Console.WriteLine("Info : {0}", ev1.str1);
                    }
                    if (ev1.type == DBSC_EventType.DBSC_EVENTTYPE_SYNC_DONE)
                    {
                        break;
                    }
                }
            }
            cli1.ShutdownServer(DBSC_ShutdownType.DBSC_SHUTDOWN_ON_EMPTY_QUEUE);
            cli1.WaitForServerShutdown(10000);
            cli1.Disconnect();
            cli1.Fini();
            Console.ReadLine();
        }
    }
}

Im Folgenden werden die öffentlichen Methoden der DbmlsyncClient-Klasse in der .NET-Version der API beschrieben.


InstantiateClient-Methode
Init-Methode
StartServer-Methode
Connect-Methode
Disconnect-Methode
Ping-Methode
Sync-Methode
ShutdownServer-Methode
WaitForServerShutdown-Methode
CancelSync-Methode
GetEvent-Methode
GetErrorInfo-Methode
SetProperty-Methode
GetProperty-Methode
Fini-Methode
DBSC_Event-Struktur