I'm trying to convert the SQLHelper Class of Microsoft.ApplicationBlocks.Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,
I'm trying to convert the
Microsoft.ApplicationBlocks.Data to work with SQL Server
CE but after some replace I've problem yet.
In particular:
===Error===============================
Cannot implicitly convert
type 'System.Data.SqlServerCe.SqlCeDataAdapter'
to "System.IDisposable'
===End Error===========================
===Code that generates error===========
// Create the DataAdapter & DataSet
using( SqlCeDataAdapter da = new SqlCeDataAdapter(cmd) )
{
//other code
}
===End Code===============================

===Error===============================
'System.Data.SqlServerCe.SqlCeCommand' does not contain a
definition for 'ExecuteXmlReader'
===End Error===========================
===Code that generates error===========
// Create the DataAdapter & DataSet
XmlReader retval = cmd.ExecuteXmlReader();
===End Code===============================

===Error===============================
'System.Data.SqlServerCe.SqlCeCommandBuilder' does not
contain a definition for 'DeriveParameters'
===End Error===========================
===Code that generates error===========
SqlCeCommandBuilder.DeriveParameters(cmd);
===End Code===============================

===Error===============================
Cannot convert
type 'System.Data.SqlServerCe.SqlCeConnection'
to 'System.ICloneable'
===End Error===========================
===Code that generates error===========
using (SqlCeConnection clonedConnection = (SqlCeConnection)
((ICloneable)connection).Clone())
{
//other code
}
===End Code===============================
===End Error===========================

Any suggestion?
Thank you.
Antonio.
 
Ok i solved the IDisposable error avoiding the use
of "using" and adding at the end of code a .dispose().
How can i clone a connection? simply assigning to a new
connection like this?
SqlCeConnection mynewconn = SqlCeConnection();
mynewconn=myoldconn;

Thank you.
===Error===============================
'System.Data.SqlServerCe.SqlCeCommand' does not contain a
definition for 'ExecuteXmlReader'
===End Error===========================
===Code that generates error===========
// Create the DataAdapter & DataSet
XmlReader retval = cmd.ExecuteXmlReader();
===End Code===============================

===Error===============================
'System.Data.SqlServerCe.SqlCeCommandBuilder' does not
contain a definition for 'DeriveParameters'
===End Error===========================
===Code that generates error===========
SqlCeCommandBuilder.DeriveParameters(cmd);
===End Code===============================

===Error===============================
Cannot convert
type 'System.Data.SqlServerCe.SqlCeConnection'
to 'System.ICloneable'
===End Error===========================
===Code that generates error===========
using (SqlCeConnection clonedConnection = (SqlCeConnection)
((ICloneable)connection).Clone())
{
//other code
}
===End Code===============================
===End Error===========================
 
Hi, there

Porting SQLHelper is a "great" work... ;)

Why do you need to clone a connection?
The way you use below makes mynewconn refer to myoldconn,
they are the same connection.
BTW, SQLCE doesn't support more than one connection at a time.

Best Regards,
Jan Yeh

..NETcf Developer & Consultant
Mobile Mind Co., Ltd. @ Taiwan
 
Back
Top