执行最终用户定义的SQL [英] executing end user defined SQL
本文介绍了执行最终用户定义的SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好:-),
在Web应用程序中,我需要接收SQL查询(事先不知道),针对SQL Server 2005 DB执行它们并显示包含结果的网格。可以在这种情况下使用Linq-to-SQL。
谢谢
提供者并返回一个Enumerable对象。您可以使用ExecuteQuery< T> DataContext上的方法。请在 http://msdn.microsoft.com/上查找MSDN文档en-us / library / system.data.linq.datacontext.executequery.aspx 了解更多信息和示例。
Hello :-),
In a web app I need to receive SQL queries(which are not known in advance), execute them against a SQL Server 2005 DB and display a grid with the results. Can Linq-to-SQL be used in this scenario.
Thanks
解决方案
Yes, Linq To Sql can run SQL queries directly against the provider and return a Enumerable of objects. You can use the ExecuteQuery<T> method on DataContext. Please look up MSDN docs at http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executequery.aspx for more information and examples.
这篇关于执行最终用户定义的SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文