如何在Web应用程序中动态生成SQL查询 [英] How to dynamically generate SQL query in a web application
本文介绍了如何在Web应用程序中动态生成SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨...
谁能建议我如何在Web应用程序中动态生成SQL查询.实际上,我正在设计一个应用程序,在该应用程序中,用户可以自由选择列和条件来查看数据库信息,但是我不知道该如何实现.
解决方案
我已经创建了一个与此类似的应用程序.
例如,查看表如下所示:
USE [DBNAME]; 选择 table_name FROM INFORMATION_SCHEMA.TABLES
对于存储的proc:
USE [DBNAME]; 选择 specific_name FROM INFORMATION_SCHEMA.TABLES
等等……Google可以在这里成为您的朋友:)
您需要做的就是连接每一行,并将其中一些用作参数使其动态化.
问候,
爱德华.
hi sidhu,
动态SQL查询 [在SQL Server中生成动态SQL语句
hi...
could anyone suggest me how can we generate SQL query dynamically in a web application. Actually i m designing a application in which a user can have the freedom to view the database information with his choice of columns and conditions But i dont know how to achieve this.
解决方案
Hi,
I have already created an application similar to this.
Like for example viewing the tables looks like this:
USE [DBNAME]; SELECT table_name FROM INFORMATION_SCHEMA.TABLES
For stored proc:
USE [DBNAME]; SELECT specific_name FROM INFORMATION_SCHEMA.TABLES
etc...... Google can be your friend here :)
All you need to do here is to concat each lines and use some of it as parameters to make it dynamic.
Regards,
Eduard.
hi sidhu,
Dynamic Sql Query[^]
Check out following link :
Generate dynamic SQL statements in SQL Server
这篇关于如何在Web应用程序中动态生成SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文