我正在使用 dateTimePicker 从 Windows 表单中的用户收集日期以插入 SQL Server 数据库但是当我调试它时它说“不能将 dateTime 转换为字符串”这是代码
string Agent = FieldAgentCombo.Text;
string Query = "INSERT INTO Comittment(Date,Field_Staff_Date,Detail,Priority,company_name,Name) values('" + Client + "','" + Agent + "','" + Date + "','" + FieldStaffDate + "','" + Detail + "','" + Priority + "')";
SqlCommand cmd = new SqlCommand(Query, conn);
int status = cmd.ExecuteNonQuery();
if (status > 0)
MessageBox.Show("record inserted");