且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建一个简单的Windows窗体来访问SQL Server数据库?

更新时间:2022-11-25 11:39:29

我会采取看看这个教程开始:

I'd start by taking a look at this tutorial:

http://msdn.microsoft.com/en-us/library/ ms178371.aspx

其基本思路是建立一个连接字符串将定义了一些事情包括:在您的数据库服务器是什么,数据库名称,以及如何连接到它

The basic ideas is to create a connection string that will define a number of things, including: where your db server is, what the database name is, and how you are connecting to it.

一旦你有你的连接字符串定义,你可能会使用的的SqlConnection 的SqlCommand SqlDataReader的类与数据库的所有交互。如果你点击链接,这三个类别,并期待在文档中,你会看到他们有pretty的很好的例子。

Once you have your connection string defined you will probably use the SqlConnection, SqlCommand and SqlDataReader classes for all interactions with the database. If you click on the links for those three classes and look at the documentation you will see they have pretty good examples.