必须声明标量变量Error [英] Must declare the scalar variable Error

查看:86
本文介绍了必须声明标量变量Error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时有错误必须声明标量变量错误

我怎么解决它?



这是我的功能

---------------------



I have error on run time "Must declare the scalar variable Error"
how i can solve it ?

this is my function
---------------------

Public Function executeUpdateQuery(ByVal _query As [String], ByVal OleDbParameter As OleDbParameter()) As Boolean
       Dim myCommand As New OleDbCommand()
       Try
           myCommand.Connection = openConnection()
           myCommand.CommandText = _query
           myCommand.Parameters.AddRange(OleDbParameter)
           myAdapter.UpdateCommand = myCommand

           myCommand.ExecuteNonQuery()



       Catch e As SqlException
           MsgBox("Error - Connection.executeUpdateQuery - Query: " & _query & " " & vbLf & "Exception: " & e.StackTrace.ToString())
           Return False
       End Try
       Return True
   End Function

推荐答案

我找到了解决方案



I Found the Solution

Replace my named parameters with "?"
for example:
SELECT COUNT(*) FROM Account WHERE AccountID = ?


这篇关于必须声明标量变量Error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆