C#, Pocket PC and SQL Database

  • Thread starter Thread starter Kam
  • Start date Start date
K

Kam

Hi everyone,

I've searched alot online trying to find any tutorial or simple example of
how to synchronize data between a pocket pc and a sql server on a desktop.

the program i've developed, create a database and a table with the extension
of (.sdf) and I would like to be able to move the new records to a table in
the desktop.

any help will be very much appreciated..

Many thanks and hope to hear from u asap..

Kam
 
Have you checked out the PocketTaskVision tutorial...
http://msdn.microsoft.com/vbasic/us...ry/en-us/dnnetcomp/html/wnf_pkttaskvision.asp

I'd also recommend a few books. Rob Tiffany just came with a killer SQL CE
Book
http://www.amazon.com/exec/obidos/t...=sr_8_1/104-0968507-3087124?v=glance&n=507846

Dan Fergus and Larry Roof also came out with a CF book which has a good
discussion on CE
http://www.amazon.com/exec/obidos/A...7868382/sr=2-2/ref=sr_2_2/104-0968507-3087124

And Steven Wheelwright and Andrew Wrigley have a really great book with a
good discussion on SQL CE
http://www.amazon.com/exec/obidos/A...7868382/sr=2-1/ref=sr_2_1/104-0968507-3087124

I'd highly recommend all of them...

HTH,

Bill
 
thanks for yr help, the links were very helpful..


however, everytime i try to pull using the set of code below an error occurs
(An internal error occured. [ID,,,,,])

//----------------------
private void btnPull_Click(object sender, System.EventArgs e)
{
SqlCeConnection cn = null;
SqlCeRemoteDataAccess rda = null;
SqlCeEngine sqlEngine = null;
try
{
btnPull.Enabled = false;

// Create database if it doesn't already exist
if (!File.Exists("\\My Documents\\IntelligenceData.sdf"))
{
sqlEngine = new SqlCeEngine();
sqlEngine.LocalConnectionString = "Data Source=\\My Documents\\" +
"IntelligenceData.sdf";
//"Encrypt Database=False";
sqlEngine.CreateDatabase();
sqlEngine.Dispose();
}
else
{
// Open the connection to the database
cn = new SqlCeConnection("Data Source=\\My Documents\\" +
"IntelligenceData.sdf");
cn.Open();
SqlCeCommand cmd = cn.CreateCommand();

// Drop the FieldMemos table
cmd.CommandText = "DROP TABLE FieldMemos";
cmd.ExecuteNonQuery();

// Close the connection
if (cn.State != ConnectionState.Closed)
{
cn.Close();
}
}

// Instantiate the RDA Object
rda = new SqlCeRemoteDataAccess();

// Connection String to the SQL Server.
string remoteConnectString = "Provider=OLEDB;" +
"Data Source=MyComputerName;" +
"Initial Catalog=IntelligenceData";

//rda.InternetLogin = "Kamal Ali";//"robtiffany";

//rda.InternetPassword = "osamah";//"pinnacle";

rda.InternetUrl = http://tmg1356/fieldagentrda/sscesa20.dll;
rda.LocalConnectionString = "Data Source=\\My Documents\\" +
"IntelligenceData.sdf";//;" +
//"SSCE:Database Password=osamah";
rda.Pull("FieldMemos", "Select * from FieldMemos", remoteConnectString,
RdaTrackOption.TrackingOnWithIndexes, "FieldMemosErrorTable");
}
catch(SqlCeException sqlex)
{
foreach(SqlCeError sqlError in sqlex.Errors)
{
MessageBox.Show(sqlError.Message, "Error");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}

finally
{
rda.Dispose();
btnPull.Enabled = true;
}
}

//--------------------------

and when i use the "SSCE:Database Password=osamah";
the following error message comes up:

( SQL Server CE encountered problems in opening the SQL Server CE database.
[,,,Database name,,]" )

Any idea where im going wrong, keep in mind that im using Anonymous access
in the SQL Server CE Agent which doesn't require User name and password to
access the resouce. in addition, the table is created in using SQL Server
Enterprise Manager.

Any help would be very much appreciated

Thanks in advance.
Kam
 
Back
Top