|
Home > Archive > MS SQLCE > September 2005 > BeginTransaction error
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
BeginTransaction error
|
|
| moricio 2005-09-12, 8:24 pm |
| Hi and thanks in advance for your help and time.
I have a piece of code like this:
SqlCeDataAdapter da = new SqlCeDataAdapter();
DataSet ds = new DataSet();
SqlCeTransaction transIPV = null;
while (true)
{
try
{
while (connIPV.State != ConnectionState.Open)
{
Thread.Sleep(25);
}
transIPV = connIPV.BeginTransaction();
break;
}
catch (SqlCeException e1)
{
Thread.Sleep(25);
}
}
I have two problems:
1. As soon as the ConnectionState is in the Open state only and the
code flows to the BeginTransaction, another thread that is part if
the program, does a fetch and an error is thrown. How to make this
happen correctly?
2. The exception thrown is not catched !!! Go figure why!
Thanks again.
Mauricio Ramirez
[/code]
| |
| Laxmi Narsimha Rao ORUGANTI \(MSFT\) 2005-09-19, 7:23 am |
| Is this connIPV is a common variable across two threads?
Are you handling this data sharing carefully?
Thanks,
--
Laxmi NRO, SQL Mobile, Microsoft Design Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
"moricio" <moricio@hotmail-dot-com.no-spam.invalid> wrote in message
news:xcSdnSjdCoO5hbv
eRVn_vA@giganews.com...
> Hi and thanks in advance for your help and time.
>
> I have a piece of code like this:
>
>
> SqlCeDataAdapter da = new SqlCeDataAdapter();
> DataSet ds = new DataSet();
> SqlCeTransaction transIPV = null;
>
> while (true)
> {
> try
> {
> while (connIPV.State != ConnectionState.Open)
> {
> Thread.Sleep(25);
> }
> transIPV = connIPV.BeginTransaction();
> break;
> }
> catch (SqlCeException e1)
> {
> Thread.Sleep(25);
> }
> }
>
>
> I have two problems:
>
> 1. As soon as the ConnectionState is in the Open state only and the
> code flows to the BeginTransaction, another thread that is part if
> the program, does a fetch and an error is thrown. How to make this
> happen correctly?
>
> 2. The exception thrown is not catched !!! Go figure why!
>
> Thanks again.
>
>
> Mauricio Ramirez
> [/code]
>
|
|
|
|
|