I'm trying to use Mobilink 12 to sync between SQL Server 2005 Database (as consolidated database) and a remote ultralite database on a windows mobile device, so i've done the following :
Now I copy the created ultralite db to my windows mobile device ,run the mobilink server and start writing the client test application as the following:
And it's running perfectly , my question is Is there anyway to create the database programmatically instead of copying it manually to the device? |
You will need to start the ML server with the -ftr switch which points to the location where the transfer files can be found. You can also have different files for different users by setting up unique folders. A simple implementation in UL.Net is ULFileTransfer transfer = new ULFileTransfer(); transfer.UserName = "u"; transfer.Version = "v"; transfer.Stream = ULStreamType.TCPIP; transfer.FileName = "MLFileTransfer.udb"; transfer.LocalFileName = "MLFileTransferReceived.udb"; string[] parms = new string[1]; parms[0] = "You need to supply something"; transfer.AuthenticationParms = parms; transfer.DownloadFile(); transfer = null; System.Console.WriteLine("File transfer complete. "); |
Look at ULDatabaseManager CreateDatabase() method to create the database. You can couple this with ULFileTransfer to transfer the schema to the remote and use "ALTER DATABASE SCHEMA FROM FILE" to create the schema in the remote. Another option is push the database to the remote using ULFileTransfer to automate the process. Seems to be a good solution ,but i've searched for any samples of how to use ULFiletransfer to download a file and I couldn't find anyone ,so it would be great if you could provide any sample for that
(10 Apr '13, 05:29)
waleedramadan
|