TableAdapter.GetData.Compute问题 [英] TableAdapter.GetData.Compute Problem

查看:94
本文介绍了TableAdapter.GetData.Compute问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试使用以下方法查找表中的最大数字:
TblInventoryTableAdapter.GetData.Compute("Max(InvID)", Nothing)


该代码仅适用于花花公子.但是由于未知原因,它在我的程序已经运行时不会更新.输入较大的值时,必须关闭我的应用程序,然后再次打开它,然后返回新输入的较大数字.仅关闭并重新打开表单是行不通的,需要关闭并重新打开整个应用程序.

我还用TblInventoryTableAdapter.GetData.Rows.Count读取行数,同时查找最大数.行数更新,这意味着TableAdaptor正在更新.因此出于未知的原因,Compute不包括新记录.:confused:

我是否必须以某种方式从表适配器释放计算功能,就像完成数据过滤后如何删除过滤器一样?

我尝试了TblInventoryTableAdapter.Update(Me.AccommodationDataSet.tblInventory),但没有区别.

任何帮助将不胜感激

Marco

Hi,

I''m trying to find the largest number in a table with:
TblInventoryTableAdapter.GetData.Compute("Max(InvID)", Nothing)


The code works just dandy. However for reasons unknown, it does not update while my program is already running. When I enter a larger value, it I have to close my app and open it again before it returns my newly entered larger number. Just closing and reopening the form does not work, the entire application needs to be closed and reopened.

I''m also reading the row count with: TblInventoryTableAdapter.GetData.Rows.Count, at the same time as finding the largest number. The row count updates, which means the TableAdaptor is updating. So for reasons unknown Compute does not include new records.:confused:

Do I have to somehow release the compute function from the table adaptor, similarly to how you remove a filter when you are done filtering data?

I have tried TblInventoryTableAdapter.Update(Me.AccommodationDataSet.tblInventory) but no difference.

Any help would be greatly appreciated

Marco

推荐答案

您尝试过TblInventoryTableAdapter.Fill吗?如果将填充前清除"设置为true,则我认为表适配器将返回数据库以使所有内容新鲜.
Did you try TblInventoryTableAdapter.Fill? If you set Clear before fill to true, I think the table adapter goes back to the database to get everything fresh.


这篇关于TableAdapter.GetData.Compute问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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