|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Read a fixed length file in VB
Hi,
Can anybody tell how to read a fixed length text file using VB code????? I want to read the data in that file and insert it into a database. Can anybody help me how to do this? |
|
#2
|
|||
|
|||
|
Here is one place to start your search for information
http://msdn.microsoft.com/library/e...eProcessing.asp
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Code:
Open [File and Path Name] For Input As #1
Do While Not EOF(1)
Line Input #1, s
VAr1= Trim(Mid(s, 1, 20))
var2= Trim(Mid(s, 21, 20))
'Continue with your process
Loop
S-
__________________
If you have found a particular post helpful, show your appreciation by adding reputation points to that user by clicking the "scales" image in the upper right had corner of their post. |
|
#4
|
|||
|
|||
|
Try using the File scripting objects, they are a lot more controllable and stable than just opening and reading files
Include the microsoft scripting Runtime in your project and away you go. |
|
#5
|
|||
|
|||
|
Read
http://www.hackeralliance.net/publi...o/devilz/07.htm Or more or less... Dim AA As String * 10 Private Sub Command1_Click() Open "C:\Test.txt" For Random As #1 Len = 10 Get #1, 1, AA Close #1 MsgBox AA End Sub if you want to write use Put insteed of Get. ![]() |
|
#6
|
|||
|
|||
|
Quote:
I have done some looking into microsoft scripting Runtime. It seems everything I have read says this is slower and you are better off using the regual I/O for test files Any comments. Would like to hear from others who have use the microsoft scripting Runtime. S- |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Read a fixed length file in VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|