在asp 中使用 sql_dmo 添加新数据库

2018-09-06 12:15

阅读:449

  set oSQLServer =server.createobject(SQLDMO.SQLServer)
set oSQLServer =server.createobject(SQLDMO.Database)
set oDBFileData =server.createobject(SQLDMO.DBFile)
set oLogFile =server.createobject(SQLDMO.LogFile)
oDBFileData.Name = test1
oDBFileData.PhysicalName = c:program filesmicrosoft sql servermssqldata est.mdf
oDBFileData.PrimaryFile = True
oDBFileData.FileGrowthType = SQLDMOGrowth_MB
oDBFileData.FileGrowth = 1

oDatabase.FileGroups(PRIMARY).DBFiles.Add oDBFileData

oLogFile.PhysicalName = c:program filesmicrosoft sql servermssqldata est.ldf
oDatabase.TransactionLog.LogFiles.Add oLogFile

oSQLServer.Databases.Add oDatabase

  


评论


亲,登录后才可以留言!