VB2008中SQL查询中的无效数据 [英] Invalid Data in SQL Query in VB2008

查看:92
本文介绍了VB2008中SQL查询中的无效数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;

我在使用VB的Visual Studio 2008中有一个项目.在我的一种表单中,我在数据库中查询供应商信息.在表单中,加载供应商信息(地址1,地址2,城市等)后,您可以更改/更新此数据.更新后, 用户将重新输入该表格,并且旧数据仍然存在.我以为更新不起作用,但确实起作用.当我直接在数据库中运行选择查询时,数据将被更新(这意味着以前的数据不再存在).那怎么样 我的表单中的SQL Query调出不存在的旧数据?我不是从项目中的数据集中检索此数据,而是在我的代码中包含直接从SQL中提取的SQL字符串.

I have a project in Visual Studio 2008 using VB. In one of my forms, I query the database for Vendor Info. In the form, after the Vendor info is loaded (Address 1, Address 2, City, etc.) you have the ability to change/update this data. After updating, the user would re-enter the form and the old data would still be there. I thought the update did not work, but it did. When I run a select query in the database directly, the data is updated (meaning the previous data doesn't even exist anymore). So how is the SQL Query in my form bringing up the old data that does not exist? I am not retrieving this data from a dataset in my project, but with a SQL string in my code that pulls directly from SQL.

这怎么可能?

我知道我的SQL查询正确.我发现项目中某处有数据库的缓存副本,但是由于我是直接从表单中查询数据库,因此如何获取不存在的数据?这可能会给我的项目造成很大的问题 是实时的,我无法显示旧的/过时的数据.

I know my SQL Query is correct. I figured there is a cached copy of the database somewhere in my project, but since I am querying the database directly from the form, how am I getting non-existent data? This could cause huge problems for me as my project is live and I cannot have it displaying old/stale data.

我在调试器中关闭了我的项目,然后重新启动它,但仍然得到相同的数据(错误的数据).第二天早上,我们再次看了看,仍然一样.一个小时后,在使用它之后,它现在检索新的(更新的)数据.所以,有一天 以后,我的代码没有任何变化,它现在可以检索并显示正确的数据.

I shut down my project in the debugger, and restarted it, and still got the same (incorrect data). The next morning we looked at it again, and still the same. An hour later, after playing around with it, it now retrieves the new (updated) data. So, one day later with no changes in my code, it now retrieves and displays the correct data.

任何人都可以在这里发生什么以及如何防止这种情况吗?

Can anyone me what is happening here and how to prevent this?

我可以根据需要提供代码示例,但是我认为代码不是问题所在,因为代码没有更改,现在可以正常工作了.

I can give you code examples if you would like, but I don't think the code is the problem because the code has not changed, and now it works correctly.

谢谢

托德

Todd Lerew

Todd Lerew

推荐答案

如果问题再次出现,请尝试执行相同的查询直接使用某些SQL工具,例如   Management Studio(对于MSSQL).

If the problem reappears, then try executing the same query directly using some SQL tool, such as  Management Studio (in case of MSSQL).

您要访问哪种数据库(MSSQL,MySQL,Access等)以及如何访问(使用ADO.NET等)?


这篇关于VB2008中SQL查询中的无效数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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