G
garak
Hi,
I got the following problem:
I have a class named PRootObjects with the first FIELD named ID.
I want to use one method (shown below) to access different FIELDs of
different classes.
I have the name of the FIELD I want to access in a STRING Variable
named FIELDNAME (e.g. string FIELDNAME = "ID").
Now I first need to cast the INSOBJ to the correct CLASSTYPE.
Then I want to access the data stored the FIELD named [content of
FIELDNAME (e.g.ID)]
-------------------------------------------------------------------------------------
public void InsertRow (Object InsObj)
{
// This does not work indeed but may show what I want to to !!!
string FieldName = "ID";
Type myType = InsObj.GetType();
InsertQuery += InsObj.FieldName; // The Value of InsObj.Fieldname
should be added to the InsertQuery
}
InsertRow (PRootObjects)
-------------------------------------------------------------------------------------
Can anyone help?
Thanks
Frank
I got the following problem:
I have a class named PRootObjects with the first FIELD named ID.
I want to use one method (shown below) to access different FIELDs of
different classes.
I have the name of the FIELD I want to access in a STRING Variable
named FIELDNAME (e.g. string FIELDNAME = "ID").
Now I first need to cast the INSOBJ to the correct CLASSTYPE.
Then I want to access the data stored the FIELD named [content of
FIELDNAME (e.g.ID)]
-------------------------------------------------------------------------------------
public void InsertRow (Object InsObj)
{
// This does not work indeed but may show what I want to to !!!
string FieldName = "ID";
Type myType = InsObj.GetType();
InsertQuery += InsObj.FieldName; // The Value of InsObj.Fieldname
should be added to the InsertQuery
}
InsertRow (PRootObjects)
-------------------------------------------------------------------------------------
Can anyone help?
Thanks
Frank