假设我有这个代码片段
Dim tab As String = "myTab"
Dim val As String = "field1"
Dim con As String = "...."
Dim qry As String 'should be: "Select * from " & tab & " where value = '" & val & "'"
Dim com As New OracleCommand (qry, con)...
还假设从数据库中检索查询字符串(即 qry 的值)。我不能将 qry 传递给 oracle 命令,因为它不会被评估,即变量没有绑定到它们的值,并且字符串按字面意思传递给命令,从而导致错误。有没有办法评估字符串并将其作为 VB 语句执行?