如何使用查询从Web API中的sql server获取数据.. [英] how get data from sql server in web API by using query..
问题描述
如何在Web API中只从sql server数据库获取一个表的数据请给我一个关于查询谁将返回一个表的数据的想法我已经尝试了很多方法但它返回所有表的所有数据
提前感谢
how can get only data of one table from sql server database in Web API please give me idea about query who will return data of one table i have try many ways but it return all data of all tables
thanks in advance
推荐答案
正如Richard在评论中提到的,要从1个表中选择数据,你所做的只是SELECT * FROM table。就这么简单。
有些东西告诉我你可能不理解你所拥有的代码,我建议你去挖掘你所拥有的东西来确定它在做什么。
As Richard mentioned in the comments, to select data from 1 table all you do is SELECT * FROM table. It's that simple.
Something tells me you may not understand the code that you have and I suggest digging in to whatever you have to determine what it is doing.
它返回所有表的所有数据
it return all data of all tables
首先,你应该给表名
。
其次,如果你使用 where子句
只需要某些数据。
因此你的查询是,
SELECT * FROM Table_Name WHERE SomeField = SomeValue
但是先学习SQL,
http://www.w3schools.com/sql/ [ ^ ]
http://www.sqlcourse。 com / intro.html [ ^ ]
-KR
First, you should give the table name
.
Second, use where clause
if you want certain data only.
Hence your query would be,
SELECT * FROM Table_Name WHERE SomeField = SomeValue
But learn SQL first,
http://www.w3schools.com/sql/[^]
http://www.sqlcourse.com/intro.html[^]
-KR
这篇关于如何使用查询从Web API中的sql server获取数据..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!