如何发布我的数据库?
我采用VB+SQL Server2000开发了一个信息管理软件,但不知如何发布我在SQL Server中建立的数据库?多谢各位! 问题点数:0、回复次数:3Top
1 楼yoki(小马哥--鬓微霜,又何妨)回复于 2003-12-01 18:40:40 得分 0
将你的数据库导出为脚本(*.sql),然后在安装程序的时候运行这个脚本文件
Top
2 楼yoki(小马哥--鬓微霜,又何妨)回复于 2003-12-01 18:41:36 得分 0
以下是运行脚本文件的方法:
用vb的话你可以这样
Private Sub CreateDataBase(cnDataBase as connect,sqlFile As String)
Dim strSql As String, strTmp As String
Open sqlFile For Input As #1
strSql = ""
Do While Not EOF(1)
Line Input #1, strTmp
If UCase(strTmp) = "GO" Then
cn.Execute strSql
strSql = ""
Else
strSql = strSql & strTmp & vbCrLf
End If
Loop
If strSql <> "" Then cnDataBase.Execute strSql
Close #1
End Sub
其他的你可以定义一个到服务器的ado连接
然后可以这样:
比如:vb中
dim cn as New ADODB.Connection
dim sql as string
cn.open ".......到服务器的连接"
sql="master.dbo.xp_cmdshell ' osql -U username -P password -i c:\myquery.sql'"
cn.execute sqlTop
3 楼hzybc(网友帮帮忙;帮帮网友忙)回复于 2003-12-01 22:06:13 得分 0
可以用程序建立数据库和表
create datebase "数据库"
create table 表名(列名 列属性,。。。)Top




