Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning null date values to Foxpro tables
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01132134
Message ID:
01132922
Vues:
11
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform