I've have a BO that I'm programatically instantiating, and filling with a stored procedure. The stored procedure only returns a single row of the SQL Server 2005 table to which it relates. What I want to do is use the Primary Key of this BO as a parameter to a stored procedure that will fill another BO (that I will also instantiate programatically) with selected records (filtered on foreign key). These BOs contain Application configuration Data and there will be no user interaction it, which is why I'm not dropping it on a form.
The Primary Key I'm trying to access is a guid. When I set a break in Visual Studio and look at the contents of the BO I see that the CurrentDataTable has a single row, and there are values in all the columns, similarly for the CurrentView, but when I look at the DTGID property (the primary key) I see the value of Guid.empty. I looked at the other columns/properties and saw that they all had the values as shown in the CurrentDataTable except for three others that contain guids which show guid.empty.
I think I have come across this before when I had a BO dropped on a form, but gave up and moved on with something else.
Does anyone have an explanation or suggestion on how to get around this?
Peter
Problem solved. My fault entirely, when I saw in the Visual studio Watch window the value of Guid.empty next to the property I was interested in I mistakenly believed that it was in fact empty.
My Boss pointed out that if I were to use a ".ToString" I'd get the string representation of what I wanted. I guess it shows once again why he's the boss.