在C#中使用数据库 [英] Working with database in C#
本文介绍了在C#中使用数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在尝试使用数据库创建应用程序,能否请您解释一下创建具有2个表和它们之间的1个关系的简单数据库的最简单方法,以及如何使用C#连接到该数据库并进行一些基本查询,例如
Hello, i am trying to create application using database, can you please explain me easiest way to create a simple database with 2 tables and 1 relation between them and how to connect to that database using C# and do some basic query like
"SELECT x FROM table WHERE ID==10"
谢谢
Thank you
推荐答案
如果要使用C#创建数据库,请参见此
创建SQL Server数据库
使用ADO.net进行数据库连接
ADO.Net
否则,sql server mgmt. studio是创建数据库和表的最简单方法.
请参见 http://www.sqlserver2005tutorial.com/
if you want to create database using C#,see this
Create a SQL Server Database
use ADO.net for database connectivity
ADO.Net
otherwise sql server mgmt. studio is easiest way to create database and tables.
see this http://www.sqlserver2005tutorial.com/
,我建议使用这种简单的方法,清楚,简短地为初学者提供丰富的CodeProject文章:为初学者使用ADO.NET [
I would recommend this simple, clear, short an informative CodeProject article for beginners: Using ADO.NET for beginners[^].
—SA
查看此处:
http://msdn.microsoft.com/en-us/library/ms228366%28v = VS.80%29.aspx
http://www.codeproject.com/KB/database/sql_in_csharp.aspx
Look here:
http://msdn.microsoft.com/en-us/library/ms228366%28v=VS.80%29.aspx
http://www.codeproject.com/KB/database/sql_in_csharp.aspx
这篇关于在C#中使用数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文