|
-
Jul 15th, 2004, 08:40 PM
#1
Thread Starter
New Member
visual basic 6.0
i want to read a text file and insert neccessary fields into access database. May i know how do i do it?
this is my text file:
Type Date Time Source Category Event User Computer
Success Audit 7/14/2004 10:04:30 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:04:30 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:01:44 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:01:34 AM Security Logon/Logoff 540 SYSTEM L340C53
Success Audit 7/14/2004 10:01:34 AM Security Logon/Logoff 540 SYSTEM L340C53
and this is my code:
Private Sub Form_Load()
Dim strEvent As Integer
Dim strUser As String
Dim strComputer As String
Dim strDate As String
Dim strTime As String
Open "C:\miNE\test.txt" For Input As #1
IREC = 0
Do Until EOF(1)
IREC = IREC + 1
Line Input #1, strLine
If IREC > 1 Then
strEvent = Mid(strLine, 1, 4)
strUser = Mid(strLine, 6, 10)
strComputer = Mid(strLine, 12, 10)
strDate = Mid(strLine, 24, 10)
strTime = Mid(strLine, 36, 10)
rs.AddNew
rs("Event") = 0
rs("User") = 0
rs("Computer") = 0
rs("Date") = 0
rs("Time") = 0
rs.Update
End If
Loop
Close
rs.Close
cn.Close
End Sub
May i know whats wrong with the code?
-
Jul 15th, 2004, 08:46 PM
#2
You're better off asking in the VB6 forum
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 15th, 2004, 09:00 PM
#3
Sleep mode
Can't believe this , are those guys blind !!!
-
Jul 16th, 2004, 01:40 AM
#4
Re: visual basic 6.0
Originally posted by hunterboy
May i know whats wrong with the code?
How about you tell us what's wrong with the code?
Have you tried it? What errors are you getting?
-
Jul 16th, 2004, 02:23 AM
#5
Thread Starter
New Member
runtime error 424 . object required
error occur at rs.AddNew
-
Jul 16th, 2004, 02:58 AM
#6
it should be
VB Code:
rs.addnew
rs.fields("Whatever") = "Whatever you want"
rs.fields("Whatever2") = "Whatever you want2"
rs.update
-
Jul 16th, 2004, 02:59 AM
#7
also have you made a referance to the ADO,
you best take a look at the guide in the database forum
-
Jul 16th, 2004, 03:40 AM
#8
The name of the reference is
Microsoft ActiveX Data Objects 2.X
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|