I have a Binary file which has to be changed to text and inserted into database
Printable View
I have a Binary file which has to be changed to text and inserted into database
declare a type with teh struct of record of your file...
type rec_t
name as string
age as long
end type
private sub LOadTableFromFile()
dim rec as rec_t
open "xxx" for bynary as #1
do while note eof(1)
get #1,,rec
'put code of insert into DB
loop
close #1
end sub
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
declare a type with the struct of record of your file...
type rec_t
name as string
age as long
end type
private sub LOadTableFromFile()
dim rec as rec_t
open "xxx" for bynary as #1
do while note eof(1)
get #1,,rec
'put code of insert into DB
loop
close #1
end sub
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
I am not able to translate a binary file to Text File
type rec_t
name as string
age as long
end type
private sub LOadTableFromFile()
dim rec as rec_t
open "xxx" for bynary as #1
do while note eof(1)
get #1,,rec
'put code of insert into DB
'tHIs is a sample of insert:
'"INSERT into tabella (name,age) VALUES (" & rec.name & "," & cstr(rec.age) & ")"
loop
close #1
end sub
U don't traslate file from bynary to text but U read directly file in bynary...
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
type rec_t
name as string
age as long
end type
private sub LOadTableFromFile()
dim rec as rec_t
open "xxx" for bynary as #1
do while note eof(1)
get #1,,rec
'put code of insert into DB
'tHIs is a sample of insert:
'"INSERT into tabella (name,age) VALUES (" & rec.name & "," & cstr(rec.age) & ")"
loop
close #1
end sub
U don't traslate file from bynary to text but U read directly file in bynary... I assume that file has a struct well defined... so U can difine its struct with VB type...
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>