mspocketpc.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating DataRow throws Exception 0xC0000005

 
Post new topic   Reply to topic    mspocketpc.org Forum Index -> Developers
Author Message
Pedro \"Shade\" Miller



Joined: 25 Feb 2008
Posts: 1

PostPosted: Mon Feb 25, 2008 5:02 pm    Post subject: Updating DataRow throws Exception 0xC0000005 Reply with quote

Hi guys,

I'm facing a very puzzling problem and thought maybe someone here
could help. It's been driving me nuts, really... Maybe it's something
dumb that I'm just not realizing.

I'm developing a Windows CE application (to be deployed in Windows CE
4.2 core) and my emulator is running Windows CE .NET v4.10 (build
908). I don't have a device with me now where I could test the
software, unfortunately (that's still being arranged).

One of the code bits is a button to consolidate data, merging rows in
a DataTable:

[CODE]
private void btnConsolidar_Click(object sender, System.EventArgs e)
{
for( int j=0; j < dataTable.Rows.Count; j++ )
{
DataRow row1 = dataTable.Rows[j];
String ean = (String)row1["ean"];
String cod = (String)( ( row1["codigo"] == null ) ? "" :
row1["codigo"] );

int idx;
for( idx=j+1; idx < dataTable.Rows.Count; idx++ )
{
DataRow row2 = dataTable.Rows[idx];
if( ((String)row2["ean"]) == ean || (cod != "" &&
((String)row2["codigo"]) == cod ))
{
long q1 = long.Parse((string)row1["quant"]);
long q2 = long.Parse((string)row2["quant"]);

if( bConferencia )
{
if( (string)row1["quant1"] == "0" )
{
string q =
(string)row2["quant1"];
//row1["quant1"] = q;
dataTable.Rows[j]["quant1"] = q; // CRASH!
}
if( (string)row1["quant2"] == "0" )
//row1["quant2"] = (string)row2["quant2"];
dataTable.Rows[j]["quant2"] =
(string)row2["quant2"];
}

row1["quant"] = q1+q2;

// remove a fileira copiada
dataTable.Rows.RemoveAt( idx );
//dataTable.AcceptChanges();
// row1 = dataTable.Rows[j];

// compensa a fileira removida
idx--;
}
}
}

dgItens.DataSource = dataTable;
dgItens.Refresh();
}
[/CODE]

Please forgive the commented extra code, I've been adding and removing
scaffolding looking for the problem.

What this does is something like this: suppose you have three rows,
thus:

A 0 0 7
B 4 3 0
A 0 0 3
C 1 5 0
A 2 2 0

It consolidates the same products to:

A 2 2 10
B 4 3 0

It works when you only have one product repeated (i.e., only one row1
is updated). However, if there are several repeated products,

A 0 0 7
B 0 0 5
A 2 2 0
B 4 3 0

the system crashes with a native exception (code 0xC0000005, which
research shows is an illegal memory access exception) when I try to
update the second row in the table (line marked "CRASH!", above). Note
that the first update goes well! Also, if I set it up with only one
product repeated, press the button, set it up with another product
repeated, and press the button again, it works.

I'm guessing it has to do with the way DataTable updates its rows, but
so far, I've had no luck figuring the problem out. I'll greatly
appreciate any help I can get!

Thanks in advance,

Shade.

Archived from group: microsoft>public>pocketpc>developer
Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Datatype Misalignmnt exception at run time Hi all, I am able to compile the C & ARM11 code using VS2005(with windows mobile 6.0 professional SDk) for WM6.0 platform. During run time on WMobile device, ARM assembly code compiled by "armasm" compiler is throwing DATA MISALIGNMENT exception, when i

Getting exception while trying to play streaming audio... Hi, I am using WM 5.0, NetCF 2.0. I am able to play video streams but when i try to play audio streams. I get exception. What i found that, i set Player.uiMode = "invisible"; or Player.uiMode = "none"; If i comment this statement then everything works fin

Adding a Work URL Exception Programatically I would like to automate the addition of a Work URL Exception on a Smartphone. I've looked at the Connection Manager APIs but have not found an obvious way to do this? Can someone please advise me on where to start?

data misalignemnt exception during run time Hi all, I am able to compile the C & ARM11 code using VS2005(with windows mobile 6.0 professional SDk) for WM6.0 platform. During run time on WMobile device, ARM assembly code compiled by "armasm" compiler is throwing DATA MISALIGNMENT exception, when i

Native Exception c0000005 error help please HI Using VS2005 and VB for HPC development I now am getting Native errors occuring when I get data from the database. It appears to happen after so many reads from the database. In searching the MS Newsgroups I see others have encountered this error but I
Post new topic   Reply to topic    mspocketpc.org Forum Index -> Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group