Help - Simply Getting Data from Extrenal Data Files (not from Access Data Base) 
Author Message
 Help - Simply Getting Data from Extrenal Data Files (not from Access Data Base)

My question has to do with getting data from files.  I have always used
random access fixed record length files.  Is Microsoft forcing people to
store their data in Access Data base (or some other data base files)?  To
use random access files, all you have to do is define a fixed-length record
structure ("user defined type") and then open the file in RANDOM mode.  But,
to define a fixed-length record structure, naturally you have to use fixed
length strings.  The new VB.NET version does not allow fixed strings in the
user define types.

I looked at the ADO approach to data retrieval, but it involves so much more
overhead compared to just defining a record structure and then opening the
file in random mode.  Plus it only works on ASCII text files in sequential
mode (as opposed to random accessed binary files).  Which is ludicrous.  The
example they show of maintaining an ASCII file using ADO requires you to
read the entire file into memory.  Then add or modify records and then
delete the file and write the whole thing out again!

Do you have any thoughts or insights on this subject?

Gratefully,

Joe
************************************************************************
P.S.
I sent the following message to Microsoft, but have not received an answer:

First of all, I love VB and have used it and other forms of Basic for over
twenty years.  I am very concerned about the loss of fixed strings in the
new VB.NET version.  How else can you define a data type (structure) when
you are describing a fixed format record for random access file i/o?  I have
tried the recommended steps in the document announcing VB.Net, but it did
not work.  It generated an error msg: "Bad Record Length"  Please advise.

An example would be:

Public Type TestType
  Field1 as String * 2
  Field2 as String * 10
End Type
Public TestRec as TestType

Open "TEST.DAT" For Random As #1 Len = Len(TestRec)
Put #1,1,TestRec
.
  .
    .



Wed, 07 May 2003 03:00:00 GMT  
 Help - Simply Getting Data from Extrenal Data Files (not from Access Data Base)
Well, I don't know much about VB.net, and I hate to say it, but maybe you
should start learning C++/C# to access files randomly.  I hear you can mix
programming languages in VS.net, so you can write your file access routines
in C and your data manipulation routines in VB?

Another idea ...

 Public Type TestType
   Field1 as String
   Field2 as String
 End Type
 Public TestRec as TestType

 TestRec.Field1 = Space$(2)
 'you get the gist...

Will that work?

Quote:
> Open "TEST.DAT" For Random As #1 Len = Len(TestRec)

Try LenB instead of Len?

Sorry if any of these suggestions are worthless, I've only been using Basic
for < 2 years.

--
Scott Shell

Please post replies both to the newsgroup and to my email address,


Quote:
> My question has to do with getting data from files.  I have always used
> random access fixed record length files.  Is Microsoft forcing people to
> store their data in Access Data base (or some other data base files)?  To
> use random access files, all you have to do is define a fixed-length
record
> structure ("user defined type") and then open the file in RANDOM mode.
But,
> to define a fixed-length record structure, naturally you have to use fixed
> length strings.  The new VB.NET version does not allow fixed strings in
the
> user define types.

> I looked at the ADO approach to data retrieval, but it involves so much
more
> overhead compared to just defining a record structure and then opening the
> file in random mode.  Plus it only works on ASCII text files in sequential
> mode (as opposed to random accessed binary files).  Which is ludicrous.
The
> example they show of maintaining an ASCII file using ADO requires you to
> read the entire file into memory.  Then add or modify records and then
> delete the file and write the whole thing out again!

> Do you have any thoughts or insights on this subject?

> Gratefully,

> Joe
> ************************************************************************
> P.S.
> I sent the following message to Microsoft, but have not received an
answer:

> First of all, I love VB and have used it and other forms of Basic for over
> twenty years.  I am very concerned about the loss of fixed strings in the
> new VB.NET version.  How else can you define a data type (structure) when
> you are describing a fixed format record for random access file i/o?  I
have
> tried the recommended steps in the document announcing VB.Net, but it did
> not work.  It generated an error msg: "Bad Record Length"  Please advise.

> An example would be:

> Public Type TestType
>   Field1 as String * 2
>   Field2 as String * 10
> End Type
> Public TestRec as TestType

> Open "TEST.DAT" For Random As #1 Len = Len(TestRec)
> Put #1,1,TestRec
> .
>   .
>     .



Fri, 09 May 2003 03:00:00 GMT  
 Help - Simply Getting Data from Extrenal Data Files (not from Access Data Base)
Hi Scott,

I have tried this already and it generated a "Bad Record Length error"

Regards,

Joe


Quote:
> Well, I don't know much about VB.net, and I hate to say it, but maybe you
> should start learning C++/C# to access files randomly.  I hear you can mix
> programming languages in VS.net, so you can write your file access
routines
> in C and your data manipulation routines in VB?

> Another idea ...

>  Public Type TestType
>    Field1 as String
>    Field2 as String
>  End Type
>  Public TestRec as TestType

>  TestRec.Field1 = Space$(2)
>  'you get the gist...

> Will that work?

> > Open "TEST.DAT" For Random As #1 Len = Len(TestRec)

> Try LenB instead of Len?

> Sorry if any of these suggestions are worthless, I've only been using
Basic
> for < 2 years.

> --
> Scott Shell

> Please post replies both to the newsgroup and to my email address,



> > My question has to do with getting data from files.  I have always used
> > random access fixed record length files.  Is Microsoft forcing people to
> > store their data in Access Data base (or some other data base files)?
To
> > use random access files, all you have to do is define a fixed-length
> record
> > structure ("user defined type") and then open the file in RANDOM mode.
> But,
> > to define a fixed-length record structure, naturally you have to use
fixed
> > length strings.  The new VB.NET version does not allow fixed strings in
> the
> > user define types.

> > I looked at the ADO approach to data retrieval, but it involves so much
> more
> > overhead compared to just defining a record structure and then opening
the
> > file in random mode.  Plus it only works on ASCII text files in
sequential
> > mode (as opposed to random accessed binary files).  Which is ludicrous.
> The
> > example they show of maintaining an ASCII file using ADO requires you to
> > read the entire file into memory.  Then add or modify records and then
> > delete the file and write the whole thing out again!

> > Do you have any thoughts or insights on this subject?

> > Gratefully,

> > Joe
> > ************************************************************************
> > P.S.
> > I sent the following message to Microsoft, but have not received an
> answer:

> > First of all, I love VB and have used it and other forms of Basic for
over
> > twenty years.  I am very concerned about the loss of fixed strings in
the
> > new VB.NET version.  How else can you define a data type (structure)
when
> > you are describing a fixed format record for random access file i/o?  I
> have
> > tried the recommended steps in the document announcing VB.Net, but it
did
> > not work.  It generated an error msg: "Bad Record Length"  Please
advise.

> > An example would be:

> > Public Type TestType
> >   Field1 as String * 2
> >   Field2 as String * 10
> > End Type
> > Public TestRec as TestType

> > Open "TEST.DAT" For Random As #1 Len = Len(TestRec)
> > Put #1,1,TestRec
> > .
> >   .
> >     .



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Getting Tab separated data from Word to Access, Excel or simply process it from VB

2. Getting Tab separated data from Word to Access, Excel or simply process it from VB

3. password protected Access data base with Data Control

4. Data-bound Masked Edit makes all data-bound controls not display data

5. Help: API Returns a data set, but I can not retrieve the data correctly

6. Use Outlook data as relational data base?

7. New data control based on Remote Data Service

8. Accessing Acces Data Base files and win 3.1

9. can't access data from text file use Data control

10. printing without crystal report or data report for non data base reports

11. New data control based on Remote Data Service

12. Update a data combo based on selection in other data combo

 

 
Powered by phpBB® Forum Software