'*************************************************************************
'**函 数 名:s_ExecuteSqlFile
'**功能描述:在指定的数据库对象中,执行指定的脚本文件
'**输 入: sFileName 要执行的脚本文件名
'** : iDb 数据库对象,要求是:ADODB.Connection
'** : sPassword 登陆密码
'**输 出: 无
'**调用模块: 无
'**作 者: 邹建
'**日 期: 2004年03月09日
'*************************************************************************
Sub s_ExecuteSqlFile(ByVal sFileName$, ByVal iDb As Object)
Dim iFn As Object
Dim iSql$, iStr$
Set iFn = CreateObject("FileSystemObject").OpenTextFile("c:\1.txt", 1)
With iFn
While .AtEndOfStream = False
iStr = iFn.ReadLine
If UCase(iStr) = "GO" Then
If iSql <> "" Then
iDb.Execute iSql
iSql = ""
End If
Else
iSql = iSql & vbCrLf & iStr
End If
Wend
If iStr<>"" Then iDb.Execute iSql
iFn.Close
End With
End Sub