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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.