'以下代码,仅供参考
Public Function BuildData(ByVal SQLPath_File As String, ByVal strServerName As String, ByVal strLoginID As String, ByVal strPassword As String)
Dim l_str_sql As String
Dim l_str_Line As String
Dim l_int_FileNum As Integer
Dim l_str_SqlView As String
Dim t_conDb As New ADODB.Connection
Dim strCon As String
Dim rstTmp As New ADODB.Recordset
Dim strDiskID As String
Dim strcoName As String
Dim strSerial As String
Dim strRegDate As Date
Dim strEndDate As Date
Dim lngZong As Long
l_int_FileNum = FreeFile
l_str_sql = ""
Open SQLPath_File For Input As #l_int_FileNum
Do Until EOF(l_int_FileNum)
Line Input #l_int_FileNum, l_str_Line
If UCase(Trim(l_str_Line)) = "GO" Then
If InStr(1, l_str_sql, "*/") = 0 Then
l_str_SqlView = Trim(l_str_sql)
Else
l_str_SqlView = Trim(Mid(l_str_sql, InStr(1, l_str_sql, "*/") + 2))
End If
t_conDb.Execute l_str_sql, , adCmdText + adExecuteNoRecords
l_str_sql = ""
Else
l_str_sql = l_str_sql + l_str_Line
End If
Loop