"Field" does not belong to table error.


Author
Message
Ertan Deniz
Ertan Deniz
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 163, Visits: 493
To handle this error, I've generated FieldAccessing Event for all fields.

But the code that event is fired comes after the code that column is accessed. So, I couldn't handle this condition. I'm trying to catch property access, check column if exist. If column does not exist then column will be added to the table.

Is there alternative way to accomplish tis type of requirement ? 

object loValue;

CompaniesFieldAccessingEventArgs e;

System.String loReturn;

loValue = this.CurrentRow["name"];

if (loValue == DBNull.Value)

{

loReturn = String.Empty;

}

else

{

loReturn = (System.String)loValue;

}

e = new CompaniesFieldAccessingEventArgs(CompaniesFieldNames.name, loReturn);

this.OnFieldPropertyAccessing(this, e);

return (System.String)e.ValueToReturn;


Reply
Ertan Deniz
Ertan Deniz
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 163, Visits: 493
As you said, there may be many points to consider. Each of them have to be handled with specific code.

In my case, I want to handle "Object.Property1" case. When I'm trying to use property1, I need to ensure that the field is in the datatable. I couldn't write control logic for each property. Is there a general way that is known? This is my need.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search