Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning null date values to Foxpro tables
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132134
Message ID:
01132922
Views:
10
Kevin,

Yes, I am getting a Mere Mortals ! error: "String was not recognized as a valid datetime."

I tried storing null to the field a couple of different ways, with no success.

Here's the code for the textchanged method:
    //Birth date validation
    protected void txtBirthDate_TextChanged(object sender, EventArgs e)
    {
        if (!mmType.IsEmpty(this.txtBirthDate.Text))
            this.txtBirthDate.Text = ValidDate(this.txtBirthDate.Text);
        else
            this.txtBirthDate.Text = null;
    }

    protected string ValidDate(string datevalue)
    {
        DateTime CheckDate;
        try
        {
            CheckDate = DateTime.Parse(datevalue);
            return CheckDate.ToShortDateString();
        }
        catch
        {
            lblErrorMessage.Text = "Invalid date entered.";
            return null;
        }
    }
Here's the code I tried in the business rules:
        public string Validatebirthdate(DateTime birthdate)
        {
            string Msg = null;
            if (mmType.IsEmpty(birthdate))
            {
                this.DataRow["birthdate"] = null;
            }
            return Msg;
        }
Thanks for your help.

Linda
Linda Harmes
HiBit Technologies, Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform