That probably won't make much difference to the execution time. Files are stored in memory, which is much faster that accessing from a hard drive. Even then, when you do a read, the OS read a whole block in. Reading part of a record takes essentially the same time as reading the full record.
Split() is also a fast operation. Try removing it from your loop: it won't make a huge difference. Do some benchmarking to find the bottlenecks. If nothing else helps, can you build the database on the desktop instead? >Also When using the File.Find command how to I code it so that for the >specific line in the file .eg. 1,C0AAA006,"AAA MOBILE STORAGE >(ON)",,,,,,,,,,,,0001,,,,,, >I only want it to search the data in the second comma, in the examples >case above it would be "C0AAA006" and not have to read the entire line, >i only want it to search that specific spot for each line in the file > >you guys have been a big help thus far so I really appreciate the help. > >--- In [email protected], "bigp...@..." <bigp...@...> wrote: >> >> Yes, with some testing it is the INSERT that is slowing it down... A >LOT. Without the insert the file with 30,000 records gets read within 5 >minutes. >> >> Yes the quotes are always present. >> >> Is there no faster way to INSERT records from a text file to the database? >> >> --- In [email protected], "joespan123" <joes@> wrote: >> > >> > >> > >> > Hi, >> > >> > Are you sure that reading the file is the slowest part. >> > >> > I would think that performing the INSERT to the database would be >slowest part. >> > >> > The use of "Split" may be a slow function call. >> > >> > Can you guarentee the quotes are all ways present, if so you may be >able to use the "Mid" function to strip off the quotes. >> > >> > >> > Also I use the "file.LineInputString()" to read a line from a file, >maybe try using that to see if it is faster than "File.ReadText(-3)". >> > >> > Cheers >> > Joe >> > >> > --- In [email protected], "bigpete@" <bigpete@> wrote: >> > > >> > > I have a file with This type of record >> > > >> > > 1,C0AAA006,"AAA MOBILE STORAGE(ON)",,,,,,,,,,,,0001,,,,,, >> > > >> > > >> > > >> > > Now I have this following code >> > > >> > > Do >> > > recs = File.ReadText(-3) >> > > SplitRecs= Split(recs,",") >> > > NoQuotes = Split(def(2),"""") >> > > >> > > i = i+1 >> > > txtrecords.Text = i >> > > cmd="INSERT OR REPLACE INTO ""NameDB"" VALUES( """ & SplitRecs >(1) & """,""" & NoQuotes(1) &""")" >> > > showstatus SplitRecs(1) & " - " & NoQuotes(1) >> > > >> > > >> > > It takes a while for the file to get read in (About 5 minutes to >read 1000 records :s) >> > > >> > > Is there a way that I can get File.ReadText or some other way to >only read the first 3 piece of data after the comma's... 1,C0AAA006,"AAA >MOBILE STORAGE(ON)"???...instead of the entire line. I think that may >speed up the searching. This file has about 30,000 records. >> > > >> > > OR is there another way I can get that data from a file read into >the SQL lite database? >> > > >> > >> > > > > >------------------------------------ > >Yahoo! Groups Links > > > -- You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en.
