purplehaze1
Programmer
In SQL Server database, Social Security field is defined as integer which is not
a required field and may have null value. So, in my program, I have public property
SocialSecurity that returns integer. My problem is, if the user doesn't enter
ss number, then I get an error. How can I solve this problem? Thanks.
e.g.
Public Property SocialSecurity() As integer
Get
Return m_ssnum
End Get
Set(ByVal Value As integer)
m_ssnum = Value
IsDirty = True
End Set
End Property
'the code fails if social security is left blank
With oPatient
.CustomerID = cbTC.SelectedValue
.genderID = cbGender.SelectedValue
.RecipCareStatusID = IIf(cbPStatus.Text = "Inpatient", 1, 2)
.RaceID = cbRace.SelectedValue
.FirstName = txtFName.Text.ToString().Trim()
.MiddleInitial = txtMInit.Text.ToString().Trim()
.LastName = txtLName.Text.ToString().Trim()
.DOB = CType(dtbday.Text, Date)
.USResident = IIf(rResidentYes.Checked, "Y", "N")
.SocialSecurity = txtSSNum.Text.Trim()
End With
a required field and may have null value. So, in my program, I have public property
SocialSecurity that returns integer. My problem is, if the user doesn't enter
ss number, then I get an error. How can I solve this problem? Thanks.
e.g.
Public Property SocialSecurity() As integer
Get
Return m_ssnum
End Get
Set(ByVal Value As integer)
m_ssnum = Value
IsDirty = True
End Set
End Property
'the code fails if social security is left blank
With oPatient
.CustomerID = cbTC.SelectedValue
.genderID = cbGender.SelectedValue
.RecipCareStatusID = IIf(cbPStatus.Text = "Inpatient", 1, 2)
.RaceID = cbRace.SelectedValue
.FirstName = txtFName.Text.ToString().Trim()
.MiddleInitial = txtMInit.Text.ToString().Trim()
.LastName = txtLName.Text.ToString().Trim()
.DOB = CType(dtbday.Text, Date)
.USResident = IIf(rResidentYes.Checked, "Y", "N")
.SocialSecurity = txtSSNum.Text.Trim()
End With