I have been experimenting with writing applications that use a local SQL Database to store data. I am using Visual Studio to create Windows Forms applications and then connecting them to a database and using LINQ to SQL to pass data to and from the DB. My question is, when I deploy this program on a target machine, what requirements must that 开发者_如何学运维machine have? Does it need to have SQL Server installed?
If the database needs to be local there could be some requirements. It depends on what edition of SQL Server you plan on running. SQL Server Express Edition (this replaces MSDE) is free but will need to be installed. Your other major option is SQL Server Compact Edition (SQL CE). That version does not require an install but it does have reduced capabilities. Check out this for a better understanding of the different types of SQL Server. There are some links there to more information on the specific editions.
Yes, the target PC must have SQL Server installed or be able to connect to a SQL Server on the network.
Your app should prompt for SQL login credentials and use them to connect to that server.
Client can also use free MSDE, if your app is not demanding.
Yes, the target machine will either need to have a local database engine installed, or have network access to a centralized database server. If you want a completely standalone deployable system, you'll want to deploy your database engine along with your app, and in that case SQL Server is not your best solution. You'll want something like VistaDB, Microsoft Jet, Apache Derby, or BerkeleyDB.
Deploying an application that utilizes a SQL Server database on a target computer is not a trivial endeavor. Depending upon how automated you want the install to be you would need to not only install your application but also the SQL Server instance (typically using SQL Server Express) and then configure your database on that instance of SQL Server. Then of course there are the variants that you would most likely need to support (e.g. configuring your database on the local machine or on a networked server without installing SQL Server Express).
SQL Server Compact Edition may be a better fit for your app - only you will know for sure. If you are interested in SQL CE you may want to check out this blog post regarding LINQ to SQL and SQL CE.
精彩评论