Visual Studio中的C#数据库 [英] C# Databasing in Visual Studio

查看:155
本文介绍了Visual Studio中的C#数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望创建一个可以放在服务器上的数据库,让多台计算机从我试图编写的软件中提取信息。我已经看过在Microsoft Access中创建一个sql数据库并使用它连接到我的软件....我完全不知道如何做到这一点我试图自学....这是正确的方法去?有没有更好的方法?

I am looking to create a database that I can put on a server and have multiple computers pull information from via software I am attempting to write. I have looked at creating a sql database in Microsoft Access and using it to connect to via my software.... I know absolutely nothing about how to do this and Im attempting to teach myself.... Is this the correct way to go? Is there a better way?

推荐答案

您不想使用Access,您想使用SQL。在微软的网站上甚至有免费版本的SqlExpress。



正如Bill所建议的,在这里搜索sql和C#的文章,谷歌也有大量的例子。 br />


当你遇到某些特定问题时,请回来,我们很乐意帮助你。
You don't want to use Access, you want to use SQL. There are even free versions of SqlExpress at Microsoft's site.

As suggested by Bill, search the articles here for sql and C# and google has tons of examples as well.

When you get stuck on something specific, come back and we'll gladly help you.


Visual Studio是一个IDE你要创建应用程序和项目。您可以在其中创建数据库,在客户端系统中使用它,允许用户通过Visual Studio工作。



但是有更好的方法可以做到这一点。继续,在您的计算机中安装SQL Server。您可以使用免费的Express版本,您将了解SQL Server。使用基于Internet的应用程序时,访问的效率并不高。使用SQL Server。



其次,您可以创建数据库连接的实例,该连接字符串用于本地或远程连接到数据库。即使您在SQL Database Management Studio中,仍然需要提供该连接字符串。它通常是这种形式



Visual Studio is an IDE for you to create applications and projects. You can create a database in it, use it in your client systems, allow users to work all through the Visual Studio.

But there is a better way of doing this. Go ahead, install SQL Server in your machine. You can use Express version that is free and you will get the understanding of the SQL Server. Access is not that much efficient while working with Internet based applications. Use SQL Server.

Secondly, you can then create an instance of your database connection, that connection string is used to connect to the databases, locally or remotely. Even if you're inside the SQL Database Management Studio, you will still be required to provide with that connection string. It is of this form generally

// yes it is a string.
string connectionString = "Server= myServerAddress; Database= myDataBase; Trusted_Connection= True;"





以上连接字符串是从此网站 [ ^ ]。您可以从该网站找到更多这些连接字符串。



通常人们将身份验证模式设置为Windows身份验证,因此上述连接字符串可以正常工作。否则您也可以设置用户名和密码。



尝试给出这一篇文章 [ ^ ]用于启动SQL数据库进度的读取。



您可以从SQL DBMS创建用户帐户,然后可以使用客户端计算机上的连接字符串来使用SQL。 Visual Studio与此无关。它只是一个IDE,仅用于开发过程,一旦开发,它将是您的SQL Server的一项工作,允许远程(因为您将从客户端计算机使用数据库)连接到您的数据库,您的客户将连接到您在连接字符串中指定的服务器上的数据库。



Above connection string was captured from this website[^]. You can find more of these connection strings from that website.

Usually people set the authentication mode to Windows authentication thus the above connection string works. Otherwise you can set username and passwords too.

Try giving this one article[^] of mine a read to start your SQL database progress.

You can create user accounts from your SQL DBMS, you can then use a connection string on your client machine to work with the SQL. Visual Studio has nothing to do with this one. It is just an IDE and will be used for developmental process only, once developed it will be a job for your SQL Server to allow remote (since you're going to use the database from client computers) connections to your database and your clients will connect to the database on the server which you specify inside your connection string.


这篇关于Visual Studio中的C#数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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