当我尝试运行以下代码时,我收到错误消息oledb exception

时间:2015-06-24 08:04:57

标签: vb.net visual-studio-2010 visual-studio

这是我的代码,它与一个按钮相关联。基本上我想重新计算“MI”的值并自动更新所有数据库。运行此代码时我得到了

  

未处理的oledb异常的错误消息与附加   信息:定义了太多字段

。任何人都可以帮我找出它的错误。

    CustomersBindingSource.MoveFirst()
    Dim b As Integer
    b = CustomersBindingSource.Count
    Dim n As Integer
    n = 0
    While n <= b
        Button1.PerformClick()
        n = n + 1
        CustomersBindingSource.MoveNext()
    End While

    Form7.Show()

1 个答案:

答案 0 :(得分:0)

尝试

 While n <= b 
 if n = b then
    Button1.PerformClick()
    n = n + 1
 else
    n = n + 1
    CustomersBindingSource.MoveNext()
 end if
End While

尝试运行CustomersBindingSource.MoveNext()时可能是索引超出范围错误