当我用英语在文本框中提出问题时,从数据库中检索数据 [英] Retrieve Data From Database When I Ask A Question In Textbox In English Language

查看:111
本文介绍了当我用英语在文本框中提出问题时,从数据库中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要根据我在文本框中键入的问题,在从数据库中获取的gridview中显示数据.例如,如果我的数据库包含Id,Name,Disease列,并且如果我想根据疾病从数据库中检索Id,name,我将在文本框中输入获取Id,患有H1N1的患者的姓名" gridview中所有具有H1N1的记录.如何实现这一点,我认为在这里我们需要将获取H1N1患者的ID,姓名"与疾病进行比较,然后显示结果.您能否让我知道如何使用sql query,c#asp.net为此编写代码.

在此先感谢

Hi,

i need to display data in gridview that is fetched from database based on the question i type in a textbox. For example if my database contains Id,Name,Disease columns and if i want to retrieve the Id,name from Database based on disease say i will type in the textbox "get the Id,name of the patients having H1N1" it has to display all the records in gridview having H1N1.How to implement this ,i think here we need to compare the question "get the Id,name of the patients having H1N1" with disease and then display the result. Can you please let me know how to write the code for this using sql query,c# asp.net.

Thanks in advance

推荐答案

我认为您低估了做出类似工作所需的精力.进行合理工作量的唯一方法是规定用户在输入查询时必须遵循的严格语法.用更自然的关键字来思考类似SQL的事物.为此,您必须研究解析器,语法和特定领域的语言.但是,如果您希望允许用户以他选择的任何单词输入查询,那么您将不得不求助于自然语言处理,这将变得极其复杂.

因此,我的建议是:要么坚持使用传统方法,要么让用户输入不使用句子而是使用UI控件的搜索条件-或构建特定于域的语言.为此,我建议使用以下工具:
http://goldparser.org/ [ ^ ]
https://code.google.com/p/bsn-goldparser/ [
I think you''re underestimating the required effort to make something like this work. The only way to make this work with a reasonable amount of effort is to dictate a strict syntax the user has to obey when entering his query. Think something roughly like SQL just with more natural keywords. For that you would have to look into parsers, grammars and domain specific languages. But if you would want to allow the user to enter the query in whatever words he chooses then you would have to resort to natural language processing and it will get extremely complex.

So, my suggestion: Either stick with the traditional approach and let your users enter their search criteria not with sentences but with UI controls - or build a domain specific language. For that, I would suggest these tools:
http://goldparser.org/[^]
https://code.google.com/p/bsn-goldparser/[^]

You will find examples on those pages.


这篇关于当我用英语在文本框中提出问题时,从数据库中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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