"Field" does not belong to table error.


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Remark : Devexpress Grid tries to reach each property even if is not selected. An exception occurs. So, every column and plus custom fields have to be included in the query.

Ahhh....yeah, that makes sense.  Glad you found a solution.

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I've found a hard way which seems to be infeasible. StrataFrame may solve this internally.

My Solution : In CurrentDataTableReFilled event, I 'm trying to define all the fields that are not included in the query.

Remark : Devexpress Grid tries to reach each property even if is not selected. An exception occurs. So, every column and plus custom fields have to be included in the query. 

Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
Any Comment ?
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 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.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This depends entirely on your code.  When I have this issue, and depending on how I may use it, I may include this in the AfterAddNew or the CurrentDataTableRefilled event...it depends entirely on what you are trying to accomplish...I am not sure how to give you a straight answer on this without digging into your code.
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
Any comment ?
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 163, Visits: 493
I know your method. I couldn't get answer how to use this method. See post below.

http://forum.strataframe.net/Topic15238-6-1.aspx

if you give a new position for FieldAccessing Event. This may solve the situation.

But I need quick way to progress. Where is the place to call the method. (EnsureColumnExist) There must be a central point.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
In our medical app I created a shared method in our of our base classes that I pass over a DataTable, expected field, and field type.  It then ensures that the column exists within the DataTable so that if a query is not performed, yet I have code expecting that field to have been returned from the query, I do not get an error.  This way I can use it across BOs, etc.
Ertan Deniz
Ertan Deniz
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 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;


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