gpt4 book ai didi

mysql - VB.Net中的SQL语句错误

转载 作者:行者123 更新时间:2023-12-01 00:39:27 26 4
gpt4 key购买 nike

这是我在 VB.Net 中 Debug模式下得到的 SQL 语句。

SELECT  dt_Date as 'Date', 
s_Time as 'Time',
s_For as 'For',
s_Categ as 'Category',
s_Count as 'Count',
s_Remarks as 'Remarks'
FROM Entry
WHERE (s_ENo = '22' and dt_date BETWEEN '06-05-16' And '27-05-16')

我不确定上面的陈述有什么问题,因为在我看来一切都很好。

错误信息的描述

Additional information: Conversion failed when converting date and/or time from character string.

有什么解决这个谜题的建议吗?

最佳答案

如果是字符串文字,则使用强类型参数。除了避免 SQL Server 端的数据类型转换问题外,参数:

  • 避免以特定方式格式化日期/时间字符串文字
  • 通过提供执行计划结果来提高性能
  • 防止 SQL 注入(inject)(禁止服务器端的动态 SQL)

关于mysql - VB.Net中的SQL语句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37069731/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com