Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
No worries, we are good, I just want to help you get your problem resolved...and I am sure that you have no issue with that goal either So that is why I was suggesting going at another sample that more accurately represents your problem so that we can hopefully get to the bottom of this.
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
You have misinterpreted what I have been writing. I am not at all intending to be caustic in my remarks. There is no professionalism in that. I am extremely grateful for every snippet of help given. As I implement the ideas supplied here and attempt to fix my problem, I only report back to the forum what is happening. If I do not follow a certain logic, I mention it. Not trying to be a dork here. Perhaps it looks that way. Sorry.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
You can put this on the DevEx support forum, but it won't help you any. This has nothing to do with the grid other than the fact that the field is being evaluated on a Dispose. I know that you don't get what I am telling you, and Greg has tried to tell you the very same thing that I have been trying to tell you. So let's start over. You have asked for help, you created a sample that reproduced the problem. I downloaded the sample that you gave and reproduced the problem on the version 8.1 grid. I showed you an example of how to resolve the error by trying to make you understand that if you are going to create a custom property that relies on an underlying column pulled back from a query...that column must exist in the result set!!! For example, you can't create a custom property that attempts to pull from the CurrentRow if that column isn't within the CurrentDataTable. You are welcome to post another sample if your first sample did not accurately depict your problem, which at this point it apparently did not since I corrected it and reposted it and you are still not pleased with the results. If you do not supply "surgical precision-type" help, then you need to supply "surgical precision-type" details, otherwise we cannot help. We have tried for a week now to help you with this problem and have gotten nowhere other than some frustrated and caustic remarks. So let's take the emotion out of the equation and start over....by starting with a sample that accurately depicts your problem. Past that, the bantering back and forth has not gotten anywhere and we are a week into the problem with no resolution....though I and Greg both seem to understand your problem, we cannot seem to make you understand the underlying issue. So at this point, let's go back to the sample, create one that shows exactly what you are trying to do since you did not like my previous answer, I will correct it and repost it. Thanks.
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Using a DataGridView . . . success. Using a DevEx GridControl . . . failure. The same error popup on window close: "Exception has been thrown by the target of an invocation. Do you want to correct the value? Yes. No." If I select "Yes" the window stays open. If I select "No" the window closes. The version of the DevEx GridControl is 8.2.4. I am running on the latest SF release 1.6.6. I will try to put this into the support and forums of DevEx. Maybe someone there can provide some further direction.
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Thanks, Greg. The code works in the test project using a simple "SELECT * FROM Movies" query. I will see how it behaves in my application. Stand by.
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Bill, I'm not sure if this will help (the last suggestion didn't ), but maybe... When you have a custom property that is using code like: this.CurrentRow["ItemsCount"] this means that there must a column in the data table named "ItemsCount". Apparently, this column will get called when the BO is disposed (didn't know that), if the data table doesn't have that column it will break. So, you just have to code for that. In cases like this (were I don't always want or need the value from a custom property and want to get the data from the underlying data table), I've started using code like this within my property getter: if this.CurrentDataTable.Columns.Contains("ItemsCount")
{
if this.CurrentRow["ItemsCount"] != null && this.CurrentRow["ItemsCount"] != DbNull.Value
{
return this.CurrentRow["ItemsCount"];
} else
return 0;
}
} else
{
return 0;
} With this code (hopefully my C# is close enough to understand), it returns the value from the datatable if the column has been loaded and if the value is set, otherwise it returns zero. For any situations where I need to use the custom property, I make sure I include the appropriate SQL to load that column. Hope this gets you closer! I know your frustration in learning this stuff!
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Bill, as I have mentioned in previous posts as well, I cannot help you without a good sample. I don't want to have to piece all of this together in hopes that I reproducing your problem. I would rather have a sample in my hands that reproduces your problem so that I can help you. I downloaded your sample, reproduced the error, made it work and reposted it. If that was not your problem, then please post another sample that does accurately reproduce the issue. Going back and forth will not get your problem resolved otherwise it would have happened already. I have already shown you how to reproduce the error. You can reproduce the error even with your updated sample project. It's easy to reproduce. I am unable to provide you more than that. That was exactly my point, Bill!!!!! YOU MUST either pull back a value from the server as a column that represents the custom property you are trying to pull (ItemsCount) or perform some type of calculationo with the data that you did pull back...using your query YOU DO NOT HAVE A COLUMN named ItemsCount that can be accessed from the CUrrentRow of the BO!!!!! I don't think I see your point. What point are you referencing? Do you see my point? I do not want the custom property referenced in the grid. Why should I even reference it in my query? If the custom property has to be reference in every query, then to fill the BO "Select * from MyTable" should never work. I should always get an eval error along the way somewhere.
Here's another piece of the puzzle...remove the grid and throw text boxes onto the form to reference the same three fields. Open the form, navigate to a few records, then close the form. NO ERROR!!! So, something is up with the grid via the BBS. I should be able to add a grid, connect it to the same BO through a BBS, show the same three fields in the grid and it should work. It doesn't. Closing the form generates an error. That is what I am looking for an explanation on. If the BBS somehow forces the custom property to be evaluated, then how do I turn that off on an instance by instance basis? On some forms, I want that custom property to show on a grid...on others, like this one, I do not.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
That was exactly my point, Bill!!!!! YOU MUST either pull back a value from the server as a column that represents the custom property you are trying to pull (ItemsCount) or perform some type of calculationo with the data that you did pull back...using your query YOU DO NOT HAVE A COLUMN named ItemsCount that can be accessed from the CUrrentRow of the BO!!!!!
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Bill, as I have mentioned in previous posts as well, I cannot help you without a good sample. I don't want to have to piece all of this together in hopes that I reproducing your problem. I would rather have a sample in my hands that reproduces your problem so that I can help you. I downloaded your sample, reproduced the error, made it work and reposted it. If that was not your problem, then please post another sample that does accurately reproduce the issue. Going back and forth will not get your problem resolved otherwise it would have happened already.
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Change this . . . public void FillAll() { FillDataTable("SELECT Movies.*, mv_pk As ItemsCount FROM Movies"); }
. . . to this . . . public void FillAll() { FillDataTable("SELECT Movies.* FROM Movies"); }
. . . and the error occurs. I do not understand. The column should evaluate as null, therefore return a value of zero. Why does this error? What if all I wanted was to list the movie titles (SELECT mv_Title FROM Movies) and display the results in a grid, would this not be a valid query since custom properties are involved in the BO? Should I always have to fill the custom properties with something (SELECT mv_Title, 0 AS ItemCount FROM Movies) even if I am not going to reference the custom property(-ies), or any other property (e.g. mv_Year, mv_Rating, etc.)?
|
|
|