如何读取*.txt的内容后存入access数据库??

wolfs 2001-06-15 10:13:00
如何读取*.txt的内容后存入access数据库??
...全文
41 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
OLD_VB_FAN 2001-06-16
http://jszb.jsagri.gov.cn/vb/去看看吧
回复
OLD_VB_FAN 2001-06-16
这问题也太便宜了,才5分呀!
回复
wolfs 2001-06-15
Private Sub Command1_Click()
Dim fsys As Scripting.FileSystemObject
Dim frec As String
Dim ftext() As String
Dim fdate As Date
Dim count As Integer
Dim frushtime As Date
Set fsys = CreateObject("scripting.filesystemobject")
Set fstream = fsys.OpenTextFile("d:\flw.txt", ForReading)
Dim conn As New ADODB.Connection
conn.Open "dsn=netflow;uid=xiaxuan;pwd=sym"
Do While fstream.AtEndOfStream = False
frec = fstream.ReadLine
ftext = Split(frec, ",")
If InStr(Trim(ftext(9)), "-") = 1 Then
fip = ftext(10)
fport = ftext(11)
Else
fip = ftext(9)
fport = ""
End If
fdate = ftext(4) & " " & ftext(5)
fname = ftext(1)
If Weekday(fdate) = vbSunday Or Weekday(fdate) = vbSaturday Then
Else
If (ftext(5) > #8:30:00 AM# And ftext(5) < #12:00:00 PM#) Or (ftext(5) > #1:30:00 PM# And ftext(5) < #6:00:00 PM#) Then
MsgBox "属于符合条件的记录,导入到数据库!”"
conn.Execute "insert into tbflow (name,ondate,ip,port) values (fname,fdate,fip,fport)" ______此处问题大大的,就是把访问日志导入数据库
我没有分了!?
Else
End If
End If
Loop
conn.Close
Set conn = Nothing
frushtime = Now()
lbltime.Caption = "您更新数据库的时间是" & frushtime
End Sub
回复
相关推荐
发帖

1188

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2001-06-15 10:13
社区公告
暂无公告