如何创建一个包含我所有表(来自 ASPNETDB 的表和我的其他表)的数据库?
按照我的理解,在 VWD 2008 Express 中开发的项目与 VS2008 不同,只能访问一个数据库。所以,我想我绝对需要将所有表定位在一个唯一的数据库中。我所说的表是指:我为应用程序创建的表以及框架 (ASPNETDB) 创建的默认表。
这是我的连接字符串(我需要修改它吗???)
<connectionStrings>
<add name="MyWebsiteConnectionString"
connectionString="data source=.\SQLEXPRESS;
Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient"
/></connectionStrings>
- 在创建 ASPNETDB 后,我是否应该只在其中添加我的表?
我应该先创建一个数据库,然后在其中添加默认表吗??? (如何?)
现在为了简单起见,我希望在 App_Data 文件夹下创建该数据库。
谢谢
The way I understood it, a project being developed in VWD 2008 Express, unlike in the VS2008, can only access one DB. So, I guess I need absolutely to locate all my tables in a unique DB. By tables, I mean: tables I create for my application as well as the default ones created by the framework (ASPNETDB).
Here's my connection string (Do I need to modify it????)
<connectionStrings>
<add name="MyWebsiteConnectionString"
connectionString="data source=.\SQLEXPRESS;
Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient"
/></connectionStrings>
- Should I, after I've created ASPNETDB, merely add my tables in it?
Should I, first create a DB, then add default tables in it??? (how?)
To make it simple for now, I would like that DB to be created under the App_Data folder.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是不正确的。您可能只能对一个数据库使用可视化向导(我不知道),但您当然可以在代码中连接到所需数量的数据库。部署后,asp.net 站点甚至不知道您是否使用了 Visual Studio(例如,当然可以使用记事本构建站点),更不用说您使用的是 Visual Studio 的哪个版本了。
其次,可以使用 Visual Studio 附带的命令行工具在任何您想要的数据库中创建“框架创建的默认[表]”。只需查找
Aspnet_regsql.exe
程序即可。This is not true. You may only be able to use a visual wizard for one db (I don't know), but you can certainly connect to as many databases as you need to in your code. After deployment, an asp.net site doesn't even know if you used visual studio at all (it's certainly possible to build a site using notepad, for example) let alone what edition of visual studio you used.
Secondly, the "default [tables] created by the framework" can be created in any database you want using a command line tool that comes with Visual Studio. Just look for the
Aspnet_regsql.exe
program.