vb.net 为什么这个错误..命令文本没有设置为命令对象

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18824551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 15:05:16  来源:igfitidea点击:

Why this error .. command text was not set to command object

vb.netacc

提问by user2780962

conn.Open()

连接.Open()

    Try
        Dim update As New OleDbCommand
        update.Connection = conn
        update.CommandText = " UPDATE O_name SET fname= '" & Name1.Text & "' WHERE ID = '" & ID.Text & "'"
        update.ExecuteNonQuery()
        MsgBox("done")
    Catch ex As Exception
        MsgBox(ex.Message.ToString)
    End Try

    conn.Close()

there is always Error " Command Text was not set to command object " what's the reason please don't talk about parametrized query cause i'm asking about this specifically

总是出现错误“命令文本未设置为命令对象”是什么原因请不要谈论参数化查询,因为我正在专门询问这个

回答by Thorsten Dittmar

A quick google for the error message has a link to this pageas the first search result, where someone writes:

错误消息的快速谷歌有一个链接到这个页面作为第一个搜索结果,有人写道:

The problem was EvaluateAsExpression was not set to true..its working now..thanks again for the help :)

问题是 EvaluateAsExpression 没有设置为 true..它现在工作..再次感谢您的帮助:)

What kept you from using Google and finding it as quicky as I did?

是什么让您无法像我一样快速地使用 Google 并找到它?