Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

A simple enough problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AlBruAn - 01 Jun 2007 01:30 GMT
I have a class I've written that works great as is; however, I now need to
add three additonal fields to it.  One of the additional fields is an
integer, as is the case with the already existing field...actually, I guess
property would be the better name for it...anyway; the other two properties
are for date fields.  Admittedly, my mind is a bit fried from a lot of
overtime, but I can't figure out how to modify this class for the life of me.
The code is as follows:

Imports System.Configuration
Imports System.Data.SqlClient
Imports Common.DataAccessLayer
Imports Common

Namespace Outreach

   <Serializable()> _
   Public Class CallEpisodes

#Region " Local variables "

       Private _CallEpisodeIds As CallEpisodes

       Private Shared _ConnectionString As String = _
           ConfigurationManager.ConnectionStrings("EPSDTMain").ToString

#End Region

       Sub New(ByVal CallEpisodeIds As CallEpisodes)

           _CallEpisodeIds = CallEpisodeIds

       End Sub

       ''' <summary>
       ''' Retrieves all the Call Episodes associated with a MemberID
       ''' </summary>
       ''' <param name="memberID"></param>
       ''' <returns>A list of all CallEpisodes for this MemberID</returns>
       ''' <remarks></remarks>
       Public Shared Function RetrieveCallEpisodesByMemberId(ByVal memberID
As Integer)

           Dim ce As New List(Of Integer)

           Dim dr As SqlClient.SqlDataReader =
SqlDataAccess.ExecuteReader(_ConnectionString, _
               "Outreach.RetrieveCallEpisodesByMemberId", memberID)

           Do While dr.Read()
               ce.Add(dr("CallEpisodeID"))
           Loop

           If dr IsNot Nothing Then
               dr.Close()
           End If

           Return ce

       End Function

   End Class

End Namespace

How do I go about adding BeginDate, EndDate and ScriptID to this class such
that I can return the information?
Jon Skeet [C# MVP] - 01 Jun 2007 07:27 GMT
> I have a class I've written that works great as is; however, I now need to
> add three additonal fields to it.  One of the additional fields is an
> integer, as is the case with the already existing field...actually, I guess
> property would be the better name for it...anyway; the other two properties
> are for date fields.  Admittedly, my mind is a bit fried from a lot of
> overtime, but I can't figure out how to modify this class for the life of me.

Which bit of it is confusing you? Do you understand how the current
code works?

(One thing to note: your region of "local variables" is actually a
region of instance variables. Local variables are variables declared
within a method.)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.