hi all

I want to ask what wrong with my code.
It gives me error :

MySqlException unhandled
Incorrect datetime value: '08/03/2011 00:00:00' for column 'Date' at row 1

the code is below:

private void btnsave_Click(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("", false);
            DateTime datedt = Convert.ToDateTime(tbdate.Text);
            Decimal pricedec = Convert.ToDecimal(tbprice.Text);
            string insert="insert into tbl1(Date,Price)values('"+ datedt + "','"+            pricedec + "')";
            MySqlCommand cmdinsert = new MySqlCommand(insert,conn);
            conn.Open();
            cmdinsert.ExecuteNonQuery();
            conn.Close();



        }

in TextBox tbdate i fill :"08/03/2011"
CurrentCulture is"en-US'

how to solve ?

thank you

danny

Edited 3 Years Ago by pyTony: fixed formatting

This question has already been answered. Start a new discussion instead.