Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8313253
  • 博文数量: 1413
  • 博客积分: 11128
  • 博客等级: 上将
  • 技术积分: 14685
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-13 10:03
个人简介

follow my heart...

文章分类

全部博文(1413)

文章存档

2013年(1)

2012年(5)

2011年(45)

2010年(176)

2009年(148)

2008年(190)

2007年(293)

2006年(555)

分类: 数据库开发技术

2006-07-31 17:52:57

When MSDE setup is completed successfully on target machines, only the following databases will be available with MSDE:

master
model
msdb
tempdb
Once you have redistributed the custom database (.mdf) file onto the target machine as shown in step 4 of the "Manual Setup" section above, you can then apply any of the following approaches:

Run the stored procedure "sp_attach_db" to attach your database to MSDE as follows:
EXEC sp_attach_db @dbname = N'dbname', @filename = N'filepath\filename.mdf'
	
EXEC sp_attach_db 'Test', 'c:\Mssql7\Data\Test.mdf'
						
Use the Microsoft OLEDB Provider for SQL Server to attach the .mdf database file and connect to the database directly. In this case, the connection string should resemble the following:
"Provider = SQLOLEDB.1; User ID = your_user_id; Password = your_password;Initial Catalog = db_name; Data Source = server_name;
Initial File Name = db_file_path\db_file_name.mdf"
						
Use the Microsoft OLEDB Provider for SQL Server to point to the local MSDE. In this case, the connection string should resemble the following:
"Provider = SQLOLEDB.1; User ID = your_user_id; Password = your_password;
 Initial Catalog = db_name; Data Source = (local)"
						
Use the Microsoft OLEDB Provider for ODBC drivers (MSDASQL) to connect to MSDE. You can create a DSN on each target machine or use a DSN-less connection

NOTE: The third and fourth approaches above require attaching the database prior to using the connection string(s).
You can optionally use SQL-DMO to start MSDE, attach or/and detach your custom database to MSDE.
阅读(2298) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~