搜索数据库并在DataGridView中显示结果. [英] Searching a database and displaying results in a DataGridView.

查看:65
本文介绍了搜索数据库并在DataGridView中显示结果.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编码领域的新手,这似乎是非常基础的东西,但是我似乎无法自己获得它或找到可以遵循的教程.

我的数据库是一个Access数据库,具有约3万行和32列.我需要处理的两列可以称为ColumnA和ColumnB. ColumnA是我的主键,并且每次大约20条记录的ColumnB中的值都相同.

我有一个CheckedListBox,用户可以在其中输入一个或多个值,该值将与存储在ColumnA中的每条记录的值相同.

我需要做的是在数据库中搜索所有已检查的值.然后,我需要获取同一记录中的ColumnB值,并显示与ColumnB匹配的所有记录.

希望我已经澄清了,如果您需要进一步说明,请告诉我.

I am new to the coding world and this seems like it would be very basic stuff however I just do not seem to be able to get it on my own or find a tutorial that I can follow.

My database is an Access database that has ~30k rows and 32 columns. The two columns I need to work with we can call ColumnA and ColumnB. ColumnA is my primary key and the value in ColumnB will be the same for 20 or so records, every time.

I have a CheckedListBox that the user enters one or more values into, this value will be the same value as what is stored in ColumnA for each record.

What I need to do is search the database for all checked values. Then, I need to get the value of ColumnB that is in the same record and display all records that match ColumnB.

I hope I have made this clear, if you need further clarification please let me know.

推荐答案

不太清楚这是您的意思吗?

Not quite sure if this what you mean

SELECT ColumnB<br />
FROM table<br />
WHERE ColumnA IN (value1, value2, ...)


这篇关于搜索数据库并在DataGridView中显示结果.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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