O
Oshiko
My problem is, I can use SqlCeRemoteDataAccess to pull the data
successfully. But when I use SqlCeDataAdapter to retrieve data to Dataset,
the SqlCeRemoteDataAccess will throw 27750 SqlCeException.
The code is like this, the exception will throw during the creation of
SqlCeRemoteDataAccess. Please help. Thank you.
if(this.dataSet == null)
this.dataSet = new DataSet();
// Remove the table if it is existed.
if(this.dataSet.Tables.Contains(this.tableName))
this.dataSet.Tables.Remove(this.tableName);
GetDataSet(this.dataSet, this.localConnectionString, this.tableName,
"Select * From Accounts", "AccountID");
this.dataRows = this.dataSet.Tables[this.tableName].Select("LocalID =
0");
SqlCeRemoteDataAccess rda = null;
try
{
rda = new SqlCeRemoteDataAccess(this.internetUrl,
this.localConnectionString);
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
**************************************
public void GetDataSet(DataSet dataSet, string connectionString, string
tableName, string selectCommandText, string[] primaryKeys)
{
SqlCeConnection connection = new SqlCeConnection();
connection.ConnectionString = connectionString;
try
{
connection.Open();
SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(selectCommandText,
connection);
try
{
dataAdapter.Fill(dataSet, tableName);
SetPrimaryKeys(dataSet, tableName, primaryKeys);
}
catch(Exception e)
{
string a = e.Message;
}
finally
{
dataAdapter.Dispose();
}
}
catch(Exception e)
{
string a = e.Message;
}
finally
{
connection.Close();
connection.Dispose();
}
}
successfully. But when I use SqlCeDataAdapter to retrieve data to Dataset,
the SqlCeRemoteDataAccess will throw 27750 SqlCeException.
The code is like this, the exception will throw during the creation of
SqlCeRemoteDataAccess. Please help. Thank you.
if(this.dataSet == null)
this.dataSet = new DataSet();
// Remove the table if it is existed.
if(this.dataSet.Tables.Contains(this.tableName))
this.dataSet.Tables.Remove(this.tableName);
GetDataSet(this.dataSet, this.localConnectionString, this.tableName,
"Select * From Accounts", "AccountID");
this.dataRows = this.dataSet.Tables[this.tableName].Select("LocalID =
0");
SqlCeRemoteDataAccess rda = null;
try
{
rda = new SqlCeRemoteDataAccess(this.internetUrl,
this.localConnectionString);
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
**************************************
public void GetDataSet(DataSet dataSet, string connectionString, string
tableName, string selectCommandText, string[] primaryKeys)
{
SqlCeConnection connection = new SqlCeConnection();
connection.ConnectionString = connectionString;
try
{
connection.Open();
SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(selectCommandText,
connection);
try
{
dataAdapter.Fill(dataSet, tableName);
SetPrimaryKeys(dataSet, tableName, primaryKeys);
}
catch(Exception e)
{
string a = e.Message;
}
finally
{
dataAdapter.Dispose();
}
}
catch(Exception e)
{
string a = e.Message;
}
finally
{
connection.Close();
connection.Dispose();
}
}