开发者

How to search an entire column for one or two keywords

I am in the process of creating a program, using Visual Basic Express, for a physics professor who has recently had to rename all 1500 questions for his course. I created a database that has the old names, new names, and the entire contents of each question. The program seemed an easy enough idea, but has proved to be very difficult for me. I am new to programming (this is only my third go at it) and have searched for an answer to my problem for at least 20 hours, and have yet to find anything that will work for what I need.

What I would like is to have a text box in which he can type in a keyword (such as "Sun", "ISS", "Force", etc) and for the program to search throughout the entire "questioncontents" column and pull out any que开发者_运维知识库stions that contain those words into the datagrid. As of yet the closest I have gotten is for it to search the first word of the column, which is not very useful since most of them start with "The".

I had also thought of creating several keyword columns and then just having it search through those, but I couldn't figure out how to apply the filter to multiple columns.

This may be a stupid question, and if so I apologize, but I am desperate to figure this out as the semester begins relatively soon and I would like to show him how to use it before classes start. Any suggestions or help would be very greatly appreciated.


According to my understanding of the question:

SELECT * FROM question WHERE questioncontent LIKE '%SUN%';

As simple as that, you just have to replace SUN in the above query with the value entered in the textbox

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜