使用C#windows应用程序选择位置创建数据库 [英] Select location create database using C# windows application

查看:94
本文介绍了使用C#windows应用程序选择位置创建数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个小型计费软件。我想将数据存储到选定的位置。现在我使用文件夹浏览器对话框来选择位置,但我不知道使用mdf文件每年创建一个数据库。 Plz帮助我....



我尝试过的事情:



为用户选择的位置创建年份数据库。

解决方案

这实际上取决于您使用的是哪种数据库。

你说MDF文件,通常是SQL Server,您不应该尝试自己创建它们,也不应该参与它们的存储位置 - 这完全取决于SQL Server本身。如果你确实在特定的位置创建它们,那么很有可能它们不能在生产中工作,因为将数据库附加到SQL只适用于localhost EXpress版本,这不是你在外面使用的开发。

相反,让SQL服务器使用适当的CREATE DATABASE SQL语句,然后使用CREATE TABLE等来处理它的存储位置: SQL CREATE DATABASE语句 [ ^ ]

Hi, I'm creating a small billing software. I want to store data to selected location.Now i am using folder browser dialog to select the location but i don't know to create a database for per year using mdf file. Plz help me....

What I have tried:

Create a year database to user selected location.

解决方案

It really depends on what kind of database you are using.
You say MDF files, which are normally SQL Server, and you shouldn't try to "create" them yourself, nor should you be involved in where they are stored - that is all up to SQL Server itself. If you do create them in a specific location, there is a very, very good chance that they won't work in production as Attaching a DB file to SQL only works on the localhost EXpress editions, and that isn't what you use outside development.
Instead, let SQL server take care of where it's stored by using the appropriate CREATE DATABASE SQL statement, followed by the CREATE TABLE and so forth: SQL CREATE DATABASE Statement[^]


这篇关于使用C#windows应用程序选择位置创建数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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