[英]Short Date from text field into sql statement ms access
strSQLzm1a = "INSERT INTO dbGrafikTest (imieNazwisko, numerTelefonu, zmiana, praca, data) VALUES ('" & Me!listZM1a.Column(0) & "', '" & Me!listZM1a.Column(1) & "', 'zm1', 'automatyk', #" & Me!txtData & "#);"
This SQL statement returns error: 此SQL语句返回错误:
Syntax error in date in query expression '#21.03.2016'.
查询表达式'#21.03.2016'中日期的语法错误。
txtData
is a text field
and its formated as Short Date
. txtData
是一个text field
,它被格式化为Short Date
。 I'm searching googles to find the answer for where i made a syntax error and i really dont understand where i did it. 我正在搜索谷歌找到我在哪里做出语法错误的答案,我真的不明白我做了什么。
Database column data
is formated as Date/Time
as well. 数据库列
data
也形成为Date/Time
。
The db engine can't cope with 21.03.2016
as a date literal. db引擎无法将
21.03.2016
用作日期文字。
Format
it in a way which the db engine can use. Format
数据库引擎可以使用的方式。
Change this ... 改变这个......
& Me!txtData &
to this ... 对...
& Format(Me!txtData, "yyyy-m-d") &
Or you could use a parameter query, and then supply the needed Date/Time value without format concerns. 或者,您可以使用参数查询,然后在不考虑格式的情况下提供所需的日期/时间值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.