Pocket PC and sql server ce database

K

Kam

Hi everyone,

Im new to SQL Server CE Agent, i've used the tutorial in (SQL Server CE Database Development with the .NET Compact Framework - Rob Tiffany)

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
 
B

Brian Sabino [MS]

Your remote connection string looks wrong to me. Try
string remoteConnectString = "Provider=sqloledb;" +
"Data Source=MyComputerName;" +
"Initial Catalog=IntelligenceData";

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Hi everyone,

Im new to SQL Server CE Agent, i've used the tutorial in (SQL Server CE
Database Development with the .NET Compact Framework - Rob Tiffany)

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
 
K

Kam

I've been playing around with this connection string but it's not the
problem as when i used the breaking point, the exception comes up with the
Pull method is executed!!

don't know wot to do!!


Brian Sabino said:
Your remote connection string looks wrong to me. Try
string remoteConnectString = "Provider=sqloledb;" +
"Data Source=MyComputerName;" +
"Initial Catalog=IntelligenceData";

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Hi everyone,

Im new to SQL Server CE Agent, i've used the tutorial in (SQL Server CE
Database Development with the .NET Compact Framework - Rob Tiffany)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top