Private strSaveFileName As String
Private Sub txtTestExport_Click()
Dim dt As New CDataTran '????
Dim objConn As Connection '不需要用ADODB.Connect吗?
Set objConn = New Connection
objConn.ConnectionString = "Provider=MSDASQL;" & _
"Driver={SQL Server};" & _
"Server=devsvr;" & _
"Database=smtest;" & _
"Uid=lcg;" & _
"Pwd=;"
objConn.Open
Dim rstemp As Recordset '为什么不是ADODB.Recordset呢
Set rstemp = objConn.Execute("select project_id from yw_task")
Dim projectIds As New Collection '?Collection是什么?
While (Not rstemp.EOF)
projectIds.Add (rstemp(0))
rstemp.MoveNext
Wend
cdgFile.InitDir = "C:\Program Files\gtoa\" 'cdgFile是通用对话框,InitDir是什么意思?
cdgFile.FileName = "1212"
cdgFile.Flags = &H10& Or &H200& '这句有什么用?
cdgFile.Filter = "Xml Files (*.xml)|*.xml"
cdgFile.ShowSave
' If GetSaveFileName <> "" Then
dt.Export objConn, projectIds, "1", cdgFile.FileName '"c:\testexport.xml" '这个也不懂
' End If
End Sub
Private Function GetSaveFileName() As String
Dim fhandle As Integer
Dim Fname As String
GetSaveFileName = cdgFile.FileName
End Function
'判断文件是否存在, 存在返回True (strFileName为绝对路径,含扩展名)
Private Function FileExist(strFileName As String) As Boolean
Dim FileSystem As Object
Set FileSystem = CreateObject("Scripting.FileSystemObject") '这句也还是不懂,呵呵
FileExist = FileSystem.FileExists(strFileName)
Set FileSystem = Nothing
End Function
请问蓝色那些都是什么东东呢?不懂啊,向在家请教啦,谢谢哦~~