All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
JS开发字典探测用户名或密码工具_JavaScript技术_编程技术
谈SQL Server 2005中的T-SQL增强_[SQL Server教程]
安全知识:如何隐藏,PHP文件后门的技巧_php资料_编程技术
实例简析SQL嵌套子查询_[SQL Server教程]
SQL SERVER数据库开发之触发器的应用_[SQL Server教程]
HTML语言剖析(一)Html简介_[Html教程]
SQL Server得到表记录总数另类方法_[SQL Server教程]
PHP语法中基本符号及使用方法_[PHP教程]
精通数据库系列之入门-技巧篇2_mssql学习_编程技术
从,PHP,迁移到,ASP.NET(1)_[Asp.Net教程]
Reading number is top 10 pictures
Azusa Yamamoto2
男人,就要活出棱角
The money of more than 100 countries and regions21
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line
青春清纯美女大集合4
这酸爽,让人不敢相信
NeedWallpaper10
The real super beauty5
The cat shit
Seductive beauty of crime1
Download software ranking
matrix1
Boxer vs Yellow2
Desire a peach blossom
Boxer vs Yellow3
艳兽都市
Boxer's Top ten classic battle2
徐若瑄成名作“魔鬼天使”
Kung fu panda - the secret of the teacher
Unix video tutorial4
Boxer Classic video3
归海一刀 published in(发表于) 2014/2/1 0:20:24 Edit(编辑)
如何自动发布MS,SQL,SERVER数据库_[SQL,Server教程]

如何自动发布MS,SQL,SERVER数据库_[SQL,Server教程]

如何自动发布MS SQL SERVER数据库_[SQL Server教程]

当您的MIS系统开发好以后,您如何尽快的分发您的数据库呢?
下面我将提供VB代码的具体实现:


Option Explicit



’define the sql connect
Dim oSQLServer As SQLDMO.SQLServer
Dim oCurrentDB As SQLDMO.Database
Dim oCurrentTable As SQLDMO.Table
Dim oTestIdx As SQLDMO.Index


’sqlDmo is Connected Yes or No
Public sName As String
Private IsConnected As Boolean


’connect to local database server
Public Function ConnectDmo() As Boolean
On Error GoTo HandleError
’If we’re connected, then disconnect and clear lists.
If IsConnected = True Then
oSQLServer.DisConnect
IsConnected = False
End If
’Begin connect to sqlserver or msde
’Attempt a connection, then fill the properties stuff.
oSQLServer.ApplicationName = "SQL-DMO Index Test"
oSQLServer.LoginSecure = True

’connect
oSQLServer.Connect "(local)", "sa", ""

IsConnected = True
ConnectDmo = True

HandleError:
’connect failth
If IsConnected = False Then
IsConnected = False
ConnectDmo = False
End If

End Function


’add a exists database to server
Public Function AddDataBase(ByVal dbName As String, ByVal DBPath As String, ByVal rstr As String) As Boolean
Dim rstring
’rstring = oSQLServer.AttachDBWithSingleFile(dbName, DBPath)
rstring = oSQLServer.AttachDB(dbName, DBPath)
AddDataBase = True


rstr = rstring
End Function


’delete the exists database
Public Function DelDataBase(ByVal dbName As String) As Boolean
Dim rstring
rstring = oSQLServer.DetachDB(dbName)
DelDataBase = True
End Function


Private Sub UserControl_Initialize()
On Error GoTo merror
Set oSQLServer = New SQLDMO.SQLServer
oSQLServer.LoginTimeout = 15
oSQLServer.ODBCPrefix = False
Name = "msdeconn1"
merror:
End Sub


Public Function isDBexists(ByVal dbName As String) As Boolean
Dim oDB As SQLDMO.Database
Dim rc As Boolean
’reconnect to database
oSQLServer.DisConnect
oSQLServer.ReConnect

rc = False
For Each oDB In oSQLServer.Databases
If oDB.SystemObject = False Then
If Trim(UCase(oDB.Name)) = Trim(UCase(dbName)) Then
rc = True
End If
End If
Next oDB

’set the return value
isDBexists = rc

End Function


Private Sub UserControl_Terminate()
’end connect the database
oSQLServer.Close
End Sub


Public Function startServer()
oSQLServer.Start True
End Function
Public Sub stopserver()
oSQLServer.Stop
End Sub


Public Property Get Name() As Variant
Name = sName
End Property


Public Property Let Name(ByVal vNewValue As Variant)
sName = vNewValue


End Property







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.