[英]How to make a SQL Server 2017 local database from C# code in Visual Studio 2017?
I am trying to write a console game in C#, however, I am running into trouble trying to generate my database for information on the characters, and stage. 我试图用C#编写一个控制台游戏,但是,尝试生成有关角色和舞台信息的数据库时遇到了麻烦。
My questions are: how do I 我的问题是:我该怎么办
I was thinking that I could use fileinfo and filestream classes to make the .mdf
file, but I would rather be safe by asking you guys. 我当时想我可以使用fileinfo和filestream类来制作
.mdf
文件,但是我想通过问你们是安全的。
.net for c# has a library for this, the using statement has to be activated manually though. .net for c#有一个用于此的库,但是using语句必须手动激活。 If you click project in visual studio and click add reference and go to the extras.
如果您单击Visual Studio中的项目,然后单击添加引用,然后转到其他。 Mysql.data should have everything you need.
Mysql.data应该具有您需要的一切。 And you can connect to the data base by just making a string out of the command.
您只需在命令中输入一个字符串即可连接到数据库。 But connect to the database first.
但是先连接到数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.