473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How do I modify a record in a textfile in vb?

How do I modify a record in a textfile in vb? Do I need 2 files?
JOhn

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #1
15 1102
Cor
Hi John,
How do I modify a record in a textfile in vb? Do I need 2 files?


Yes

Cor
Nov 20 '05 #2
* "Cor" <no*@non.com> scripsit:
How do I modify a record in a textfile in vb? Do I need 2 files?


Yes


Why?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Cor
Hi Herfried,

Did I forget again something?

I thougth one file to read the data and one file to write the changed data
back.

I am curious, because now you bring me in doubt that I have seen something
from you to do it in another way.

Cor

Nov 20 '05 #4
* "Cor" <no*@non.com> scripsit:
Did I forget again something?
No, you didn't.
I thougth one file to read the data and one file to write the changed data
back.


Why not write the data back to the same file?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Cor
Hi Herfried,
Why not write the data back to the same file?


I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.

Cor
Nov 20 '05 #6
"Cor" <no*@non.com> schrieb
Hi Herfried,
Why not write the data back to the same file?


I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power
goes down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.

I've made the same suggestion but I was adviced not to do it because it
would change the file creation date or the original file. Another way is to
create a backup of the original file, read from the backup, write into the
original file (and truncate it if necessary) and delete the backup.
--
Armin

Nov 20 '05 #7
Cor,

* "Cor" <no*@non.com> scripsit:
Why not write the data back to the same file?
I am glad I can teach you something,


I am glad to teach you something too.
That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name


No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Cor
Hi Herfried,

And what is your advice if I want to change the creation timestamp because I
find every change of a txtfile a creation?

No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile

Still it are two files and I said any other save sequence so there cannot be
a better.

:-)))

Cor
Nov 20 '05 #9
"Cor" <no*@non.com> schrieb

And what is your advice if I want to change the creation timestamp
because I find every change of a txtfile a creation?


change <> creation

(IMO)
--
Armin

Nov 20 '05 #10
* "Cor" <no*@non.com> scripsit:
And what is your advice if I want to change the creation timestamp because I
find every change of a txtfile a creation?


Mhm... I don't want that and I wouldn't use an application doing that.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #11
* "Armin Zingler" <az*******@freenet.de> scripsit:
And what is your advice if I want to change the creation timestamp
because I find every change of a txtfile a creation?


change <> creation

(IMO)


2:1

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
Cor
Hi Herfried and Armin,

Was a big travel to find something to answer.
I first had the historie from dataprocessing but that is to simple to give
an answer for you both while I become than in a corner where it is hard to
fight back..

I thought about this.

Changed means that things stay the same.

Although this is on disk and not on memory this is for me the same as

datafile as new datafile
And not
Datafile = olddatafile

And therefore I think it is newcreated.

And not an easy answer as

No I do not agree.

:-))

Cor


Nov 20 '05 #13
Cor,

* "Cor" <no*@non.com> scripsit:
Was a big travel to find something to answer.
I first had the historie from dataprocessing but that is to simple to give
an answer for you both while I become than in a corner where it is hard to
fight back..

I thought about this.

Changed means that things stay the same.

Although this is on disk and not on memory this is for me the same as

datafile as new datafile
And not
Datafile = olddatafile

And therefore I think it is newcreated.


If you change a record in a 2 GB database, do you really think the
database should be completely recreated?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
Cor
Hi Herfried,
Changed means that things stay the same.

Although this is on disk and not on memory this is for me the same as

datafile as new datafile
And not
Datafile = olddatafile

And therefore I think it is newcreated.


If you change a record in a 2 GB database, do you really think the
database should be completely recreated?

As I said I had made more messages about this and one was about a database.

I told you once never change the subject if you are arguing. I started in a
part where you could maybe beat me, now you are on one of my areas.

A database is updated by updates, inserts and deletes, never by New, so you
give exactly the answer that you agree with me, things like databases have
creation and change dates. New files should be treathen as always new
created.

Cor
Nov 20 '05 #15
* "Cor" <no*@non.com> scripsit:
A database is updated by updates, inserts and deletes, never by New, so you
give exactly the answer that you agree with me, things like databases have
creation and change dates. New files should be treathen as always new
created.


Full ACK. Nevertheless, if you change a record in a text file
"database", it's only a change.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Franco Fellico' | last post by:
Hi. Suppose to have read and displayed (using PHP) a group of row of a DB table on a dinamyc table on a HTML/PHP page. The number of row displayed could be from 1 to n. Each row contains...
7
by: Hans A | last post by:
I have a textfile "textfile.txt" containing a list of words. There is one word on each line. I want to pick two random lines from this textfile, and I have tried to do something like: //Loading...
5
by: Gunnar G | last post by:
Hello. If I wish to open a huge textfile and only change the 300th line in the file, how do I do that?
0
by: karenmiddleol | last post by:
The following code works fine I can connect to a SQL database and list all the records in the Orders table onto a web page. Now our users want me to modify it so that each row displayed as a...
5
by: asd987 | last post by:
Hi, I'm now working with Access 2000 (English) and I'm searching for an option which I can't find. I used to work with Acces 97 (Dutch) and there was a possibility to record a macro. I used this...
4
by: muttu2244 | last post by:
Hi everybody Am trying to read a csv file "temp.csv", which has the below info, compName macAddr ipAddr opSys
18
by: Jen | last post by:
Is it possible (how) to display a new record every week (or day) from a recordset?
3
by: Ray | last post by:
Hello World, I made a Windowsform that reads data from a CSV file. It works fine, but when I have read the data of a record I have to re-Debug the form to read another record. So when I put a...
1
by: asedt | last post by:
With my Excel macro and two text files I want to create a new textfile containing the first textfile then text from the sheet and then the second textfile. My problem is that i don't know how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.