private void btnUpdatebot_Click(object sender, EventArgs e)
{
string date = cboYear.Text + "-" + cboMoth.Text + "-" + cboDay.Text;
string sql =string.Format( "update Consume set ConsumDate ='{0}',Type='{1}',Category='{2}',ConsumeMoney='{3}',Descrition='{4}' where Id={5}",date.Trim(),cboType.Text.Trim(),cboxiangmu.Text.Trim(),txtjine.Text.Trim(),txtbeizhu.Text.Trim(),txtliushuihao.Text.Trim());
SqlCommand mycom = DBhelper.mycon.CreateCommand();
DBhelper.mycon.Open();
mycom.CommandText = sql;
int count = mycom.ExecuteNonQuery();
if (count > 0)
{
MessageBox.Show("修改成功");
SqlDataAdapter myda = new SqlDataAdapter();
myda.UpdateCommand = mycom;
DataSet myds = new DataSet();
myda.Fill(myds,"Conmuse");
SqlCommandBuilder mycb = new SqlCommandBuilder(myda);
myda.Update(myds,"Conmuse");
DBhelper.mycon.Close();
}
else
{
MessageBox.Show("修改失败");
}
string date = cboYear.Text + "-" + cboMoth.Text + "-" + cboDay.Text
这个我已经把它拼接成字符串了
拼接成的是字符串,明显要的是时间类型,所以,你要把字符串转化为时间类型