ff605732747 / xgcalendar

Automatically exported from code.google.com/p/xgcalendar
GNU General Public License v3.0
0 stars 0 forks source link

要访问SQL 数据库,能否把Demo数据库共享一下 #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
程序要访问SQL 数据库,能否把Demo数据库共享一下。
(本人还在学习阶段)无数据库导致Demo无法运行,在数据库�
��建立上产生了障碍。

Original issue reported on code.google.com by rusongs...@gmail.com on 8 Oct 2010 at 3:14

GoogleCodeExporter commented 8 years ago
带有数据库啊。项目中有个creattable.txt文件,是Sql脚本

Original comment by sjs...@gmail.com on 19 Oct 2010 at 1:37

GoogleCodeExporter commented 8 years ago
调试成功了~!感谢!
先通过creattable.txt文件建好数据库,(数据库名字我这取的是
AzureCalendarDb.mdf),放在项目的App_Data文件夹下。
然后把Web.config里调用数据库代码的部分修改了一下,
<add name="AzureCalendarDb" connectionString="Data 
Source=192.168.200.162;Initial Catalog=AzureCalendar;Persist Security 
Info=True;User ID=sa;Password=123456;MultipleActiveResultSets=True" 
providerName="System.Data.SqlClient"/>
改成了
<add name="AzureCalendarDb" connectionString="Data 
Source=.\SQLEXPRESS;Integrated Security=SSPI; AttachDbFilename= 
|DataDirectory|AzureCalendarDb.mdf;User Instance=true" 
providerName="System.Data.SqlClient"/>

使用的是Windows集成验证,我在本地调试一切正常了。

|DataDirectory|对应App_Data文件夹
数据库的名字在连接代码中也对应
Data Source的值根据的是安装SQL Sever时的设置,SQL Server 
Management Studio Express可以进行更改设置。

Original comment by rusongs...@gmail.com on 23 Oct 2010 at 4:19