Eltial

Hi Everyone,

I could use some help on a problem that has everyone where I work stumped..

We have a class with simple properties and are assigning different values to each property from a data reader from an SQL server 2000 instance.

We have checked all the information we can, we are definately getting the correct data from the database, there are no overloads for the properties, the variables we are assigning are different and the two calls are definately following each other. A breakpoint following the assiging shows that the values are incorrect as soon as the values are assigned.

Following the "go to definition" link in visual studio takes me to the expected properties. Breaking and following the code shows nothing unexpected.. we only use the code below.

We are using .NET 1.1 in the VS 2003 IDE.

Thanks for taking the time to think about it... any help would be appreciated.

Thanks

Steve

PS : The code to assign properties:

Dim Sector As New Model.SectorInfo

Sector.BoardingDate = drdEnquireBooking.GetDateTime(BookingSector.BoardingDateTime) 'Enum 4

Sector.DepartureTime = drdEnquireBooking.GetDateTime(BookingSector.DepartureDate) 'Enum 3

'SectorInfo Class

'The properties:

Public Property BoardingDate() As Date

Get

Return mdatBoardingDate

End Get

Set(ByVal Value As Date)

mdatBoardingDate = Value

End Set

End Property

Public Property DepartureTime() As Date

Get

Return mdatDepartureTime

End Get

Set(ByVal Value As Date)

mdatDepartureTime = Value

End Set

End Property



Re: Visual Basic General Assigning two properties two different values results in the same value on both. VS2003

weirdbeardmt

Can I just clarify the problem... when you are trying to assign values to BoardingDate and DepartureTime, the values are actually being set as the same value Or different instances of the same class




Re: Visual Basic General Assigning two properties two different values results in the same value on both. VS2003

DMan1

If you are working with time values you should use the DateTime datatype NOT the Date datatype




Re: Visual Basic General Assigning two properties two different values results in the same value on both. VS2003

Eltial

Boarding Date has a time, Departure date doesnt. They are both part of the same instance of the same class, allocated directly after each other.

Having said that, I ended up deleting the copy of hte code on our develoment machine and copying back from our production machines this morning, and exactly the same code now works... maybe it was a setting or something

However much I would like to know what was causing it, I'll mark it as closed... no longer an issue.

Thanks for the attention

Steve





Re: Visual Basic General Assigning two properties two different values results in the same value on both. VS2003

weirdbeardmt

Eltial wrote:

Boarding Date has a time, Departure date doesnt. They are both part of the same instance of the same class, allocated directly after each other.

I'm pleased it's "fixed". But since we're here, I might just mention something about your naming conventions / follow up to what DMan was getting at.

Your property for the departure is called "DepartureTime" which is a Date. But you said it doesn't have a time, so it ought really to be called DepartureDate. You said BoardingDate does have a time but it's set as a date. I suppose the property name itself is OK (I would actually call it BoardingTime), and you could use a DateTime to store more info - i.e., the actual time they boarded.

These little things make your code much easier to read and importantly, much easier for other people to maintain...

Just suggestions :)






Re: Visual Basic General Assigning two properties two different values results in the same value on both. VS2003

Eltial

I know the feeling, this is someone elses code (he left last year). We only have two programmers, so we dont really have time to go back and fix old code, only the bugs :) Dont think I could get it past my boss to go back and fix naming conventions through the whole website :)