Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / July 2008

Tip: Looking for answers? Try searching our database.

transaction & tabledirect

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ag - 17 Jul 2008 10:02 GMT
Hello,

I insert rows in a table using a tabledirect command, and a SqlCeResultSet.
Could someone help me with the following questions ?

- When are the result flushed to the disk ?
- Is it possible to use transactions ?
- is-it a good practise to maintain a SqlCeResultSet through the application
live and use it to insert rows ?

regards,
arnaud
Ginny Caughey MVP - 17 Jul 2008 13:06 GMT
arnaud,

The data in an updatable SqlCeResultSet gets flushed to the database when
you call Update, Insert or Delete. Since a SqlCeResultSet is associated with
a SqlCeConnection, I don't see any reason why the operations on a resultset
shouldn't be able to participate in transactions associated with the
connection, but I can't say that I've actually tested it.

As far as best practices, I tend to create SqlCeResultSets as needed rather
than keeping one around for the lifetime of an app, but it's probabably just
a matter of style. The main thing you want to avoid is using any single
connection on more than one thread at a time.

Signature

Ginny Caughey
Device Application Development MVP

> Hello,
>
[quoted text clipped - 10 lines]
> regards,
> arnaud
ag - 17 Jul 2008 13:34 GMT
Ginny,

Thanks for your help.

The application inserts a few rows every seconds in different tables on a
slow platform. To avoid creating each time a new Resulset, we create all the
ResultSets at start up and retreive them as needed via a Hashtable.

I would like to be able to commit a single Insert or a group of inserts. If
data is flushed when I call Insert, how could I commit my inserts with a
transaction ?

I guess I could create each time an sqlcommand "INSERT..." with a
transaction, but this would be slower.

regards,
arnaud.

> arnaud,
>
[quoted text clipped - 23 lines]
> > regards,
> > arnaud
Laxmi Narsimha Rao Oruganti [MSFT] - 18 Jul 2008 06:52 GMT
I guess SqlCeResultSet can be done inside a transaction.  Both
SqlCeDataReader and SqlCeResultSet assume the SqlCeCommand.Transaction as
their transaction.  Did you make sure to set SqlCeCommand.Transaction
correctly.  Note that, by default SqlCeConnection.CreateCommand does not
enlist into SqlCeConnection.Transaction.  You need to explicitly set that.
Please let us know if things are working after the above said changes.

Thanks,
Laxmi

> Ginny,
>
[quoted text clipped - 47 lines]
>> > regards,
>> > arnaud
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.