从字符串“select custName from tblCustMst”到“Integer”类型的转换无效

时间:2017-09-05 18:13:23

标签: mysql sql asp.net vb.net

下面的代码在第二个声明中给出了转换异常。

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

1 个答案:

答案 0 :(得分:1)

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

Dim query As String = "select CustName from tblCustMst " & "where PlantId=@PlantId"
cmd.CommandText= query
祝你好运。