【发布时间】:2016-05-16 19:47:59
【问题描述】:
我正在尝试在 vb.net 应用程序中执行此更新查询:
SQL = "UPDATE billing_calldata SET status = 'c', customer = '" & customer_sequence & "', description = '" & description & "', customer_cost = '" & customer_cost & "', customer_ac = '" & customer_ac & "', customer_sc = '" & customer_sc & "', reseller_cost = '" & reseller_cost & "', reseller_ac = '" & reseller_ac & "', reseller_sc = '" & reseller_sc & "' WHERE sequence = '" & sequence & "';"
但它需要很长时间,甚至没有完成。
关于ExecuteNonQuery()它的说法:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
什么可能导致它无法完成?
我已经复制了查询(使用正确的值)并尝试直接在服务器上运行大约需要 49 秒(但它实际上完成了)
我在表格中的sequence 列上添加了索引
【问题讨论】:
-
如果客户说
Ziggy's Hardware,您知道以这种方式创建 SQL 会崩溃吗?并且它迫使那些成本项目串起来?使用 SQL 参数 -
你对换行有什么看法?
-
@Plutonix 客户列只是一个整数,所以永远不会有任何
' -
好的,
'" & customer_sequence & "'会将整数转换为字符串。始终使用 SQL 参数