在vb6的datagridview中找到重复的数据 [英] find duplicate data in a datagridview in vb6
问题描述
如何在vb6的datagridview中查找重复数据,按名称和性别重复重复
how to find duplicate data in a datagridview in vb6,ex duplicate by name and sex
推荐答案
你好,
此论坛适用于vb.net,而不是vb6(在此处询问 for vb6).此外,vb6没有DataGridView,而是具有数据网格控件.如果您不是vb6的意思,请澄清并 准确指出重复数据的含义,因为有很多变化,例如一栏/栏,多栏等.
This forum is for vb.net, not vb6 (ask here for vb6). Also, vb6 does not have a DataGridView, instead it has a Data grid control. If you did not mean vb6 please clarify and indicate exactly what you mean by duplicate data as there are many variations e.g. one column/field, by several columns etc.
最后,无论您应该使用哪种语言在选择的网格中使用断言来防止重复出现.如果数据库表中有重复项,则可以通过SQL查找它们.
Lastly, no matter what the language you should use assertion in the grid of choice to prevent duplicates in the first place. If there are duplicates in a database table then find them via SQL.
显示以下SQL(来自 我为Microsoft做的代码示例)用于MS-Access,但也可以用于其他数据库.这里唯一的东西就是主键被给回了.
The following SQL shown (from a code sample I did for Microsoft) is for MS-Access but can work for other databases too. The unique thing here is the primary key is given back.
SELECT A.*
FROM Customers A
INNER JOIN
(
SELECT
CompanyName,
ContactName,
ContactTitle,
Address,
City,
PostalCode
FROM
Customers
GROUP BY
CompanyName,
ContactName,
ContactTitle,
Address,City,
PostalCode
HAVING COUNT(*) > 1
) B
ON
A.CompanyName = B.CompanyName AND
A.ContactName = B.ContactName AND
A.ContactTitle = B.ContactTitle AND
A.Address = B.Address AND
A.City = B.City AND
A.PostalCode = B.PostalCode
ORDER BY
A.CompanyName
这篇关于在vb6的datagridview中找到重复的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!