Public Function Creat_Table(data As String, Files As String) As Boolean
'本模块用于从*.sql中导入数据库结构到SQL Server
Dim SQL, Txtline As String
On Error Resume Next
Cn.Close
On Error GoTo Err1
ConSQL Load_ini("服务器名"), Load_ini("用户名"), Load_ini("口令"), data, "Cn"
SQL = " "
Open App.Path & "\log.txt" For Output As #2 ' 打开输出文件。
' 将错误数据写入文件。
Open App.Path & Files For Input As #1 ' 打开SQL文件。
Do While Not EOF(1)
Line Input #1, Textline
If Not (Trim(Textline) = "GO") Then
SQL = SQL & Textline & Chr(13)
Else
Cn.Execute SQL 'Mid(SQL, InStr(SQL, "C"))
SQL = " "
End If
Loop
Close #1
Close #2
'If Creat_Table = False Then
' Shell App.Path & "\log.txt"
'End If
Exit Function
Err1:
Print #2, "This is a Error !"
Print #2, Err.Description
Print #2, Err.Number
Print #2, "**********"
Creat_Table = False
Resume Next
End Function