Connecting Tech Pros Worldwide Forums | Help | Site Map

initialize an ADO object from an array of string

lluum@yahoo.com
Guest
 
Posts: n/a
#1: Jun 22 '06
Hello All,

I have a newbie question on ADO. I understand that I can initialize
ADO objects from the results of a query to a database, or from a csv
file. I have an array of strings. How can I pump the array of string
into an ADO object with one or two lines of code (like initalize ADO
from a query to db).

Thank you very much for your input.

Alex


Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Jun 22 '06

re: initialize an ADO object from an array of string


Alex,

I don't know about one or two lines of code, but you could create a
DataSet easily, add the DataTable, add the DataColumn to the DataTable, then
cycle through your array and then add the strings.

I hope you are not doing this for data binding. You can bind to the
array of strings just like you could the DataSet.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

<lluum@yahoo.com> wrote in message
news:1150937317.667371.20850@p79g2000cwp.googlegro ups.com...[color=blue]
> Hello All,
>
> I have a newbie question on ADO. I understand that I can initialize
> ADO objects from the results of a query to a database, or from a csv
> file. I have an array of strings. How can I pump the array of string
> into an ADO object with one or two lines of code (like initalize ADO
> from a query to db).
>
> Thank you very much for your input.
>
> Alex
>[/color]


lluum@yahoo.com
Guest
 
Posts: n/a
#3: Jun 22 '06

re: initialize an ADO object from an array of string


Thank you very much Nic. Two follow-up questions.

$ I don't know about one or two lines of code, but you could create a
$ DataSet easily, add the DataTable, add the DataColumn to the
DataTable, then
$ cycle through your array and then add the strings.

So, here we are using a foreach loop to do the job? Am I right?

$ I hope you are not doing this for data binding. You can bind to the
$ array of strings just like you could the DataSet.

If fact, I may also need data binding later on. Could you show me an
example of binding to an array of strings?

Thank you so much.

Alex

Closed Thread