错误-为了评估索引属性,该属性必须是合格的,并且参数必须由用户显式提供. [英] Error - In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

查看:313
本文介绍了错误-为了评估索引属性,该属性必须是合格的,并且参数必须由用户显式提供.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是VB的新手,遇到了一个我认为对我需要做的事情很有效的练习.在经过数小时的旋转和尝试在网络上找到答案之后,不用说,我知道在这个论坛上发帖,希望对vb有更好了解的人能对我有所帮助.

到达终点线

da.update(ds,"test")

我得到一个错误,我可以解决. OleDbException未处理-解析查询时出错.当我深入分析错误时,[令牌行号,令牌行偏移量,令牌错误,]]-为了评估索引属性,该属性必须是合格的,并且参数必须由用户显式提供.

Hi Everyone,

I am new to VB and I have come across an exercise that I thought would work well for what I need to do. Needless to say after hours of spinning my wheels and trying to find an answer on the net I am know posting in this forum in hope that someone with a better understanding of vb might help me.

When it gets to the line

da.update(ds, "test")

I get an error and I can figure it out. OleDbException was unhandled - There was an error parsing the query. [Token line number,Token line offset,,Token in error,,] when I drill down to the error it says - In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

Sql = "SELECT * FROM Test"
        da = New OleDb.OleDbDataAdapter(Sql, con)
        da.Fill(ds, "Test")
        con.Close()

        Dim cb As New OleDb.OleDbCommandBuilder(da)
        Dim dsNewRow As DataRow

        dsNewRow = ds.Tables("Test").NewRow()

        dsNewRow.Item("Fname") = txtFirstName.Text
        dsNewRow.Item("Lname") = txtLastName.Text

        ds.Tables("Test").Rows.Add(dsNewRow)

        da.Update(ds, "Test")

        MsgBox("COMPLETE")



请帮助我,希望对此有所帮助!

谢谢



Please I would love some help with this one!

Thanks

推荐答案

我至少想到了以下几点:

  • 如上所述,请确保该表具有正确的主键,以便能够找到要更新的行
At least few things come to my mind:

  • As already said, ensure that the table has a proper primary key to be able to locate the row to be updated
  • 请勿在您的select语句中使用*.列出客户端需要的所有列.
  • Don''t use * in your select statement. List all the columns you need at client side.
  • 您确定已为表中所有必要的列提供了值.是您只需要提供名字和姓氏的列吗?


您的测试"表是否将一列标记为主键?如果没有,则必须添加一个.
Does your Test table have a column tagged as the primary key?? If not, you''ll have to add one.


为什么这行代码甚至存在?没有道理:
Why is this line of code even present? Does not make sense:
Dim cb As New OleDb.OleDbCommandBuilder(da)



请删除它并查看.调试并分享您遇到的问题(如果有的话)的经验.



Please remove this and see. DEBUG and share your experience on what/where issue is being raised, if any more.


这篇关于错误-为了评估索引属性,该属性必须是合格的,并且参数必须由用户显式提供.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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