SqlCeException

  • Thread starter Thread starter jayderk
  • Start date Start date
J

jayderk

we are doing a call like such

try
{
invoiceReader = cmdDML.ExecuteReader();
//put them into the list box
while (invoiceReader.Read())
{
record = new myrecord();
record.Invoice_ID = invoiceReader.GetString(0);
record.Route_ID = invoiceReader.GetString(1);
record.Accepted = invoiceReader.GetString(2);
record.Accepted_date = invoiceReader.GetDateTime(3);

result.Add(record);
}
//always close the connection - we dont have many to play with
invoiceReader.Close();
}
catch (SqlCeException ex1)
{
messagebox.show(something);
}

we are catching a SqlCeException. the problem is None of the calles in this
try catch block throw a SqlCeException according to the documentation.
My question is "do you see anything in here that would cause this
exception?". also, this does not happen every time and when it does happen
we can click ok to the message box, then do the EXACT SAME THING and it
will work.

When I tried to explain this problem before I got a message back saying
"Close the connection, sleep(some time), then open the connection and retry.



Thank you in advanced,

Jay
 
The SqlCeException contains a number of properties which return information
on how/why/where the exception occured. Therefore in your catch block you
can write these out to a messagebox or similar to determine where the error
occurs:-

MessageBox.Show(ex1.Errors[0].Message);

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
Handheld Interactive Reference Guides
 
the thing is I am writing this code for both CE 4 and PocketPC 2002 I have
NEVER seen this problem on the ppc. The SQLmanager.cs code is exactly the
same.

I have tried this message box thing already.

any other suggestions?

thanks,
Jay


Peter Foot said:
The SqlCeException contains a number of properties which return information
on how/why/where the exception occured. Therefore in your catch block you
can write these out to a messagebox or similar to determine where the error
occurs:-

MessageBox.Show(ex1.Errors[0].Message);

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
Handheld Interactive Reference Guides

jayderk said:
we are doing a call like such

try
{
invoiceReader = cmdDML.ExecuteReader();
//put them into the list box
while (invoiceReader.Read())
{
record = new myrecord();
record.Invoice_ID = invoiceReader.GetString(0);
record.Route_ID = invoiceReader.GetString(1);
record.Accepted = invoiceReader.GetString(2);
record.Accepted_date = invoiceReader.GetDateTime(3);

result.Add(record);
}
//always close the connection - we dont have many to play with
invoiceReader.Close();
}
catch (SqlCeException ex1)
{
messagebox.show(something);
}

we are catching a SqlCeException. the problem is None of the calles in this
try catch block throw a SqlCeException according to the documentation.
My question is "do you see anything in here that would cause this
exception?". also, this does not happen every time and when it does happen
we can click ok to the message box, then do the EXACT SAME THING and it
will work.

When I tried to explain this problem before I got a message back saying
"Close the connection, sleep(some time), then open the connection and retry.



Thank you in advanced,

Jay
 
Back
Top