Dear All,
I have a front end form which has a couple of dropdown
menus which select data from the database based on the value selected,
the stored procedure which the program accesses outputs diffrent columns
when different values( currently 2) from the drop down are chosen. I
also have a Datagrid with bound columns which has all the columns that
can be returned, this datagrid has a couple of date columns when i
select one value from the drop down only one of the date columns should
be populated and the other one should give blanks, but the instead of
the blank the valu '1/1/0001' is being populated into the date column,
how can i eliminate this problem.
following is the code for data access layer
Public Class MasterDetailRep ort
Private _cellLine As String
Private _totalSamples As Integer
Private _study As String
Private _studyID As String
Private _altID As String
Private _dateRec As DateTime
Private _date1 As DateTime
Private _date2 As DateTime
Private _month As Integer
Private _sales As Decimal
Private _dnanbr As String
Private _geldate As DateTime
Public Property CellLine() As String
Get
Return _cellLine
End Get
Set(ByVal Value As String)
_cellLine = Value
End Set
End Property
Public Property DNANbr() As String
Get
Return _dnanbr
End Get
Set(ByVal Value As String)
_dnanbr = Value
End Set
End Property
Public Property TotalSamples() As Integer
Get
Return _totalSamples
End Get
Set(ByVal Value As Integer)
_totalSamples = Value
End Set
End Property
Public Property Study() As String
Get
Return _study
End Get
Set(ByVal Value As String)
_study = Value
End Set
End Property
Public Property StudyID() As String
Get
Return _studyID
End Get
Set(ByVal Value As String)
_studyID = Value
End Set
End Property
Public Property AltID() As String
Get
Return _altID
End Get
Set(ByVal Value As String)
_altID = Value
End Set
End Property
Public Property DateRec() As DateTime
Get
Return _dateRec
End Get
Set(ByVal Value As DateTime)
_dateRec = Value
End Set
End Property
Public Property Date1() As DateTime
Get
Return _date1
End Get
Set(ByVal Value As DateTime)
_date1 = Value
End Set
End Property
Public Property GelDate() As DateTime
Get
Return _geldate
End Get
Set(ByVal Value As DateTime)
_geldate = Value
End Set
End Property
Public Property Date2() As DateTime
Get
Return _date2
End Get
Set(ByVal Value As DateTime)
_date2 = Value
End Set
End Property
Public Property Month() As Integer
Get
Return _month
End Get
Set(ByVal Value As Integer)
_month = Value
End Set
End Property
Public Property Sales() As Decimal
Get
Return _sales
End Get
Set(ByVal Value As Decimal)
_sales = Value
End Set
End Property
Public Shared Function GetSummary(ByVa l year As Integer, ByVal
service As String) As MasterDetailRep ortCollection
Dim dsData As DataSet =
SqlHelper.Execu teDataset(Confi gurationSetting s.AppSettings(G lobal.CfgKey
ConnString), "Reports_GetOrd erSummary", year, service)
Dim items As New MasterDetailRep ortCollection
Dim row As DataRow
For Each row In dsData.Tables(0 ).Rows
Dim item As New MasterDetailRep ort
item.Month = Convert.ToInt32 (row("Month"))
item.TotalSampl es = Convert.ToInt32 (row("TotalSamp les"))
item.Sales = Convert.ToDecim al(row("Sales") )
items.Add(item)
Next row
Return items
End Function 'GetSummary
Public Shared Function GetDetails(ByVa l year As Integer, ByVal
month As Integer, ByVal service As String, ByVal study As String) As
MasterDetailRep ortCollection
Dim dsData As DataSet =
SqlHelper.Execu teDataset(Confi gurationSetting s.AppSettings(G lobal.CfgKey
ConnString), "Reports_GetOrd ersAndDetails", year, month, service, study)
Dim items As New MasterDetailRep ortCollection
Dim row As DataRow
For Each row In dsData.Tables(0 ).Rows
Dim item As New MasterDetailRep ort
item.CellLine = Convert.ToStrin g(row("Cell_Lin e_Nbr"))
item.Study = Convert.ToStrin g(row("Study"))
item.StudyID = Convert.ToStrin g(row("Study_ID _Nbr"))
item.AltID = Convert.ToStrin g(row("Alternat e_ID_Nbr"))
item.DateRec = Convert.ToDateT ime(row("Date_R eceived"))
If service = "Cellline" Then
item.Date1 = Convert.ToDateT ime(row("Freeze _1_Date"))
item.Date2 =
Convert.ToDateT ime(row("Viabil ity_1_Date"))
ElseIf service = "dnaextract ion" Then
item.DNANbr = Convert.ToStrin g(row("DNA_Nbr" ))
item.GelDate = Convert.ToDateT ime(row("Gel_Da te"))
End If
items.Add(item)
Next row
Return items
End Function End Class
End Namespace
thank you in advance
harsha
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!