Dim stm_1 As ADODB.Stream
Dim con As New ADODB.Connection
Dim rs As New ADODB.RecordsetPrivate Sub Command1_Click()
With con
.ConnectionString = "Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=ldmis2000"
.CursorLocation = adUseClient
.Open
End With With rs
.ActiveConnection = con
.Source = "Select * from POPEDOMS"
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.Open
End With
Do While Not rs.EOF
Set stm_1 = New ADODB.Stream
stm_1.Type = adTypeBinary
stm_1.Open
stm_1.Write rs.Fields("definition") //此字段为binary类型
If Dir(App.Path + "\aaa.txt") = "" Then
stm_1.SaveToFile App.Path + "\aaa.txt", adSaveCreateNotExist
Else
stm_1.SaveToFile App.Path + "aaa.txt", adSaveCreateOverWrite
End If
‘读文件内容
rs.MoveNext
stm_1.Close
Set stm_1 = Nothing
DoEvents
Loop
rs.Close
End If
End Sub
现在我每次读出写入文件中的数据,可每次都一样。可我在Java中取这个字段的值,明明每一行值是不同的,请问这是什么原因啊?有什么解决的方法没有?
stm_1.SaveToFile App.Path + "\aaa.txt", adSaveCreateNotExist
Else
stm_1.SaveToFile App.Path + "\aaa.txt", adSaveCreateOverWrite
aaa.txt前面少一个\
End If
这样不是存的最后一条记录definition的内容吗?