I want to execute the sql query based on the question. For Example, In Textbox If i enter the question like "What are the department in allahabaduniversity" means following query will be executed "select department from allahabaduniversity;" , Here department is a filed and allahabaduniversity is table,

Please Help Me to do this...



G.Arun Prasath

Recommended Answers

All 3 Replies

Your question does'nt make any sense because sql is a language with predefined rules and syntax.Unless you let whoever is writing the statement select from dropdownlists the values that represent actual database fields its going to be very hard.

You should form your queries in code depending on the selections made by users unlike letting them write the queries coz you cant control what they write.

You can however refine your question to be more clear.

I think the OP was referring to parsing the user input and using some form of language syntax rules to build an SQL statement from the words entered. This is very difficult to do properly and I would be tempted to use the drop down list method suggested above. Maybe not as cool and a little clunky, but at least it is easily achievable.


I guess you can pass those question in a dropdownlist and can pass event if that particular question is selected then the respective query has to work ...as others said its too hard to predict what they write as the input in text box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.