This section describes the methods in the .NET implementation of the DbmlsyncClient class.
The sample below shows a typical application using the .NET version of the Dbmlsync API to perform a synchronization to receive output events. The sample omits error handling for clarity. It is always good indent practice to check the return value from each API call.
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(); } } } |
The DbmlsyncClient class public methods in the .NET version of the API are shown below.
InstantiateClient method
Init method
StartServer method
Connect method
Disconnect method
Ping method
Sync method
ShutdownServer method
WaitForServerShutdown method
CancelSync method
GetEvent method
GetErrorInfo method
SetProperty method
GetProperty method
Fini method
DBSC_Event structure
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |