【问题标题】:Conversion from string "select CustName from tblCustMst " to type 'Integer' is not valid从字符串“select CustName from tblCustMst”到类型“Integer”的转换无效
【发布时间】:2018-02-14 02:34:26
【问题描述】:

下面的代码在第二条语句中给出了转换异常。

 Dim query As String = "select CustName from tblCustMst " & "where PlantId=@PlantId"
 cmd.CommandType = query

【问题讨论】:

标签: mysql sql asp.net vb.net


【解决方案1】:

你应该使用cmd.CommandText
试试这个:

Dim query As String = "select CustName from tblCustMst " & "where PlantId=@PlantId"
cmd.CommandText= query

祝你好运。

【讨论】:

  • 问题是当他将查询分配给 CommandType 时,更改为 CommandText 我敢打赌解决了他的问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-05-13
  • 2016-12-14
  • 1970-01-01
  • 2022-11-10
  • 1970-01-01
  • 2023-03-28
  • 1970-01-01
相关资源
最近更新 更多