如何在数据库中选择记录 [英] how to select record in database

查看:77
本文介绍了如何在数据库中选择记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在数据库中选择记录

推荐答案

您应该使用ORM(对象关系映射)来访问您的数据库。实体框架是一个很好的,由微软编写。



这里有一篇很棒的文章可以帮助你入门:



http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp- net-mvc-application [ ^ ]
You should use an ORM (Object Relational Mapping) to access your database. Entity Framework is a good one, written by Microsoft.

There's an excellent article here to get you started:

http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application[^]


For all您可以使用的数据库中的记录



For all records from the database you can use

select * from table_name





您可以使用的特定列



for a specific column you can use

select clumn_name from table_name 





对于特定条件中的特定列,您可以使用'where'子句



for a specific column in a specific condition you can use a 'where' clause

select Column_name from table_name where column_name=value



如下例所示


like below example

select name from Customer where ID='1234567890'




选择命令:
Select * From table_name --select all data directly from the table
Select Column_name from table_name --select particular column from the table



参考:

试试这篇文章:插入,更新,删除,使用C#在MySQL中显示数据


这篇关于如何在数据库中选择记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆