I have a simple page I'm creating that just inserts some data from textboxes in .Net using C#. I get the overflow error stating the date must be within a specific range. The text being entered in the txtBirthdate box would be something like: 01/01/1980.
When debugging, the Client1 _Birthdate object shows {1/1/1980 12:00:00}. So as far as I can tell it's doing what it's supposed to. Thanks in advance for any help.
protected void Button1_Click(object sender, EventArgs e)
{
DataClasses1DataContext db = new DataClasses1DataContext();
Client client1 = new Client
{
FirstName = txtFirstName.Text.ToString(),
LastName = txtLastName.Text.ToString(),
MiddleInitial = Convert.ToChar(txtMI.Text),
Alias = txtAlias.Text.ToString(),
Address = txtAddress.Text.ToString(),
City = txtCity.Text.ToString(),
State = txtState.Text.ToString(),
Zip = Convert.ToInt32(txtZip.Text),
Phone = txtPhone.Text.ToString(),
Birthdate = Convert.ToDateTime(txtBirthdate.Text.ToString()),
SSN = Convert.ToInt32(txtSSN.Text),
DLNumber = txtDLNumber.Text.ToString(),
Gender = Convert.ToByte(ddGender.Text),
PrimaryRace = Convert.ToByte(ddPrimaryRace.Text),
SecondaryRace = Convert.ToByte(ddSecondaryRace.Text),
Ethnicity = Convert.ToByte(ddEthnicity.Text),
Veteran = Convert.ToBoolean(ddVeteranStatus.Text),
HoH = Convert.ToBoolean(ddHoH.Text)
};
db.Clients.InsertOnSubmit(client1);
db.SubmitChanges();
}