How to generate SQL from user visual interaction?

I am planning a C # SQL Query Builder application. In principle, users should be able to generate SQL code using a visual, form-based, user-friendly wizard. All the user has to do is select which fields he / she would like, as well as impose some conditions.

I looked at a number of applications that do something similar, but none of them seem to explain exactly how the SQL code is generated.

What approaches can be taken to convert user interactions with the application into SQL code?

EDIT: Just add a few details. The application can be used with any SQL Server database.

+5
source share
3 answers

It depends on what your user can do. Since the question is very general, I can give an answer:

Try to match your flowchart with code LINQ-SQL, and the actual SQL translation will go to LINQ. So you get

  • scallability: can be mapped to various SQL, XML, ... X databases
  • reliability
+3
source

Expreesion trees can help you if you need a custom solution. http://msdn.microsoft.com/en-us/library/bb397951.aspx

I think that you can use any ORM for this, you will need to translate your objects from the user interface to queries (linq, strings or something else) using a custom engine.

0
source

0

All Articles