从 Coldfusion 中查询 SQL Server 2000
我正在尝试执行以下 CFML:
<cfquery name="koppelData" datasource="#request.DataSource#">
INSERT INTO t_user_profile
(Username, ProfileID, AanvraagID)
VALUES
(<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.username#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
<cfqueryparam value="#FORM.vragenlijst#" cfsqltype="cf_sql_integer" >)
</cfquery>
这会引发以下错误(我的 SQL Server 版本是荷兰语):
[Macromedia][SQLServer JDBC 驱动程序][SQLServer]在 VALUES 组件中执行 INSERT 指令。 de VALUES 组件 moet overeenkomen 中的 aantal waarden 与 de INSERT-instructie 中的 het aantal kolommen 相遇。
基本上翻译如下: INSERT 指令包含更多列,因为 VALUES 语句中指定了值。 VALUES 语句中的字段数必须等于 INSERT 语句中的字段数。
我做错了什么?
编辑:
单引号没有帮助,如:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver]Invalid parameter binding(s).
The error occurred in C:\Users\Adm1n\Adobe ColdFusion Builder workspace\PASS\jsexec\maak_lid.cfm: line 52
50 : '<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.username#">',
51 : <cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
52 : <cfqueryparam value="#FORM.vragenlijst#" cfsqltype="cf_sql_integer" >
53 : )
54 : </cfquery>
找到它:看看第二个参数,最后一个字符:
<cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
这是一个typ0 :-S
I'm trying to execute the following CFML:
<cfquery name="koppelData" datasource="#request.DataSource#">
INSERT INTO t_user_profile
(Username, ProfileID, AanvraagID)
VALUES
(<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.username#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
<cfqueryparam value="#FORM.vragenlijst#" cfsqltype="cf_sql_integer" >)
</cfquery>
This throws the following error (my version of SQL server is dutch):
[Macromedia][SQLServer JDBC Driver][SQLServer]De INSERT-instructie bevat meer kolommen dan er waarden zijn opgegeven in de VALUES-component. Het aantal waarden in de VALUES-component moet overeenkomen met het aantal kolommen in de INSERT-instructie.
This is basically translated as follows:
The INSERT instruction contains more columns as there are values specified in the VALUES statement. The number of fields in the VALUES statement must be equal to the number of fields in the INSERT statement.
What did I do wrong?
Edit:
Single quotes don't help, as in:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver]Invalid parameter binding(s).
The error occurred in C:\Users\Adm1n\Adobe ColdFusion Builder workspace\PASS\jsexec\maak_lid.cfm: line 52
50 : '<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.username#">',
51 : <cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
52 : <cfqueryparam value="#FORM.vragenlijst#" cfsqltype="cf_sql_integer" >
53 : )
54 : </cfquery>
Found it: take a look at the second parameter, last character:
<cfqueryparam cfsqltype="cf_sql_integer" value="#laatste#">),
It was a typ0 :-S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第二个参数末尾有一个额外的括号。总而言之:
You have an extra parenthessis at the end of the second parameter. All in all: