insert into [Task] (TaskName, BeginDate, ExpectEndTime, EndTime, TaskStatus, Category, idkey) values ('" + taskname + "','" + begintime + "','" + expectdate + "','" + endtime + "','" + taskstate + "','" + Category + "'," + idkey + ")"; 只要是你数据库里面是字符串类型的都要加是单引号:'字符串'!
把字符串和日期的两边加上单引号试试
varchar类型忘记打单引号了