dynamic reference on datarow

  • Thread starter Thread starter Rainer Klages
  • Start date Start date
R

Rainer Klages

Hello,

I tried to set a dynamic reference, but an error occurs.


dr and dr2 are DataRowa

dr("dat_field_name") contains field-names like:
cli_key
cli_name
cli_street

dr2 is set to the client-datatable.

When I tried to step with for each to the datatable occurs the error
on the following row:

sValue = dr2(dr("dat_field_name").ToString).ToString

German: "Der Objektverweis wurde nicht auf eine Objektinstanz
festgelegt"
English: "Reference not set to an instance of a object"

How can I reference the object?

Thanks

Rainer Klages
 
(e-mail address removed) (Rainer Klages) wrote in
Hello,

I tried to set a dynamic reference, but an error occurs.


dr and dr2 are DataRowa

dr("dat_field_name") contains field-names like:
cli_key
cli_name
cli_street

dr2 is set to the client-datatable.

When I tried to step with for each to the datatable occurs the error
on the following row:

sValue = dr2(dr("dat_field_name").ToString).ToString

German: "Der Objektverweis wurde nicht auf eine Objektinstanz
festgelegt"
English: "Reference not set to an instance of a object"

How can I reference the object?

Perhaps the contents of dr("dat_field_name") was NULL? so it would
result in a not found cell, which then doesn't work with ToString() :)

FB
 
thank you for your help!
You 're right. I've found the mistake by setting dr up in a for each
statement. After that I could reference to it.

greetings from northern germany!
 
Back
Top