DataRow Find method returning null?

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

Guest

Hi,

I'm having a little problem with the Find method. It keeps returning no
rows. The code is

oDA.Fill (oDS, "EDI_Files");
object[] aryKeys = new object[1];
DataColumn[] aryKC = new DataColumn[1];

aryKeys[0] = Int32.Parse(Request.QueryString["ID"]);
aryKC[0] = oDS.Tables["EDI_Files"].Columns["ID"];
oDS.Tables["EDI_Files"].PrimaryKey = aryKC;
EditRow = oDS.Tables["EDI_Files"].Rows.Find(aryKeys);

When I run this code, the EditRow is always empty. No matter what I put in
the Find criteria.

HOWEVER if for testing purposes I replace the "EditRow =
oDS.Tables["EDI_Files"].Rows.Find(aryKeys);" with something like "EditRow =
oDS.Tables["EDI_Files"].Rows[0];", EditRow contains the correct row.

Why would the find method seem to choke like this?

By the way, all objects/variables have been declared--i left them out for
brevity.

Thanks for any help

Philip
 
Philip,

I dont have an answer to your question but I am working
in as similar field as you (EDI) and ran across an
article last night that might help. it's in th Oct issue
of asp.netPro. The author shows a way to convert EDI to
XML and now you have a the ability to get to a strongly
typed dataset.

Bob
 
Bob Ranck said:
Philip,
I dont have an answer to your question but I am working
in as similar field as you (EDI) and ran across an
article last night that might help. it's in th Oct issue
of asp.netPro.
-----Original Message-----
Hi,
I'm having a little problem with the Find method. It keeps returning no
rows. The code is

oDA.Fill (oDS, "EDI_Files");
object[] aryKeys = new object[1];
DataColumn[] aryKC = new DataColumn[1];

aryKeys[0] = Int32.Parse(Request.QueryString["ID"]);
aryKC[0] = oDS.Tables["EDI_Files"].Columns["ID"];
oDS.Tables["EDI_Files"].PrimaryKey = aryKC;
EditRow = oDS.Tables["EDI_Files"].Rows.Find(aryKeys);

When I run this code, the EditRow is always empty. No matter what I put in
the Find criteria.

Thanks Bob, actually that will help down the road because I'll be working
with EDI files directly in my next project.

This project is actually just a listing of all of the EDI files we have
received recently...

So if anyone has any ideas on why the Find method wouldn't be returning any
rows, please help!

Thanks again

Philip
 
Back
Top