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 :

  1. Created a new mobilink project having the Sql Server 2005 odbc connection as a consolidated database
  2. Created a new sync model assigned the consolidated db to it -> choosed tables to include in the sync model -> created a publication "test" and a version "test
  3. Deploy the sync model -> i choose "new ultralite database" as the type of the remote database -> i check the option of "Create a remote ultralite database"

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:

  1. I create a new windows mobile project and I write the following in the form load

    String ConnString = "dbf=\Program Files\smartdeviceproject1\test.udb";

    Conn = new ULConnection(ConnString);

    Conn.Open();

    Conn.DatabaseID = 1;

  2. I added a button for the sync process to the form and added the following code to the button click event:

    Conn.SyncParms.Publications = "test";

    Conn.SyncParms.StreamParms = "";

    Conn.SyncParms.UserName = "test";

    Conn.SyncParms.Password = "test";

    Conn.SyncParms.Version = "test";

    Conn.SyncParms.Stream = ULStreamType.TCPIP;

    Conn.Synchronize();

And it's running perfectly , my question is Is there anyway to create the database programmatically instead of copying it manually to the device?

asked 07 Apr '13, 10:15

waleedramadan's gravatar image

waleedramadan
101358
accept rate: 0%


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. ");
permanent link

answered 10 Apr '13, 11:22

Chris%20Keating's gravatar image

Chris Keating
2.5k1445
accept rate: 23%

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.

permanent link

answered 07 Apr '13, 13:38

Chris%20Keating's gravatar image

Chris Keating
2.5k1445
accept rate: 23%

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×270
×130
×18
×12

question asked: 07 Apr '13, 10:15

question was seen: 1,074 times

last updated: 10 Apr '13, 11:22