Re: Help needed on Array's

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




What does the SQL Stored Procedure do? The reason i am asking is because if
the SQL Stored Procedure is being used to add the data to a database, you
really have no need to create an array or arraylist (or any other object) to
store the data in. Is there a specific reason you want to create an extra
object (sometimes there can be a reason, but it will help if you let us know
what it is)?
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3E47CB1B-FF30-41CA-B93F-D80D90FD0D4C@xxxxxxxxxxxxxxxx
Hi Nathan,

The function I need to write, will i suppose depend on how i store the
data,
be in an array or arraylist. The function will need to read through the
array
/ array list starting at index 0 . I will get the three parts of
information
and then parm the data to a SQL Stored Procedure. I am intending to step
through the array / arraylist index untill there array(index) value is
empty.

Hope that makes sense

"Nathan Sokalski" wrote:

Another thing that may affect what you want is the type accepted by the
function you say you want to pass it to (would you be able to give us the
signature of the function?). If you plan to write this function yourself,
then it probably won't make much of a difference.
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B840A1E9-C91B-449B-9171-8BECA3E3843B@xxxxxxxxxxxxxxxx
Hi PvdG42
Thanks for the reply,

The language is vb.net 2005. The data types are strings , Name, Company
,
Service and it would be simpler if they were stroed in that order, and
will
be acc accessed sequentially from the beginning of the collection. As
far
as
the file goes, there will be a mimimum of 1 record in the file, with an
esitmated maximum of about 200. I hope this helps in being able to give
advice and examples of the best way to handle this

regards
"PvdG42" wrote:



"Peter Newman" <PeterNewman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4@xxxxxxxxxxxxxxxx
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information
per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum
lines.
What
i need to do is load the information into an array / ArrayList to be
able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still
just
as
baffled. Can any one provide an example and explination?

What language are you using? You ask for examples, and it would make
sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any
data
you want to store in it, so (compared to an Array, as you only
mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When
you
define a struct, you are defining a new type to your language
compiler,
so
you can then create an ArrayList that holds multiple instances of your
new
type.

What datatype are each of the three fields you want to store? How will
the
sets of fields you want to use as arguments be stored in your
collection?
Any particular order? How will the field sets be accessed for method
calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially
huge,
that too will influence what makes sense as a solution design.









.



Relevant Pages

  • Re: Array difference
    ... is there any logical reason why the language doesn't ... What is the class of that second array inside x and what is the class ... where the data are mixed up with the declaration syntax. ...
    (comp.lang.java.programmer)
  • Re: array
    ... Because the language does not allow it. ... what's the reason? ... why array's cant be like any other type in C? ... An array isn't a type. ...
    (comp.lang.c)
  • Re: About Thread Completion Notify.
    ... This is the reason that i must keep track of the threads and they have to ... i remove it from the array. ... > (which you probably don't since you are servicing requests in separate ... you shouldn't have a need for waiting on events. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: please confirm something (jdbc)
    ... of its internal buffer so that will double the amount of memory that you need. ... That's the reason I wrote my own dynamic byte array ... Given all the memory re-allocation that goes on inside the ByteArrayOutputStream anyway, I'm not sure that one more allocation is all that much extra overhead. ... If I have two ways of coding something, and I know that one will definitely use less memory (or be quicker for whatever reason) then I will choose the one "better" one. ...
    (comp.lang.java.programmer)
  • Re: what is the best datatype for..
    ... array that will be scanned searching for the index value, ... It also won't be flexible if the input data changes for any reason, since the implementation itself is so dependent on the input data. ... Calling the dictionary solution "inefficient" is just plain dumb; it might not be quite as fast as a straight array lookup, but it's not like it's a _slow_ design. ...
    (microsoft.public.dotnet.languages.csharp)