iAnywhere.MobiLink.Client
The sample below shows a typical application using the .NET version of the Dbmlsync API to perform a synchronization and receive output events. The sample omits error handling for clarity. It is always good 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\\asa12\\bin32"); cli1.StartServer(3426, "-c server=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(); } } } |
DbmlsyncClient class
DBSC_CancelRet enumeration
DBSC_ErrorType enumeration
DBSC_EventType enumeration
DBSC_GetEventRet enumeration
DBSC_ShutdownType enumeration
DBSC_StartType enumeration
DBSC_ErrorInfo structure
DBSC_Event structure
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |