Note, I'm using C#
I am wondering what type of control I should use for iterating through the
set of records returned by callin this method below, so that I can then do
some stuff with each record like string manipulation, or taking the data for
insertion into another table, etc..
Here's the function that returns the data as an ArrayList.
Note: You'll see plain S and B since for this post, I wanted to keep our
site name confidential for thread purposes.
public static B.Products.Product[] GetAllProductsByS(int sID)
{
IDataReader dataReader = null;
ArrayList prodList = new ArrayList();
try
{
// Initialize the database connection
Database db = DatabaseFactory.CreateDatabase();
DBCommandWrapper dbCommandWrapper =
db.GetStoredProcCommandWrapper("Pr_Ssp_ProductByS" );
dbCommandWrapper.AddInParameter("@SID",
DbType.Int32, sellerStoreID);
dataReader = db.ExecuteReader(dbCommandWrapper);
while (dataReader.Read())
{
// Populate the product Var.
B.Products.Product pr = new Product();
pr.LoadCorePropertiesFromReader(dataReader);
prodList.Add(pr);
}
}
catch(Exception ex)
{
ExceptionPublisher.Publish(ex, "B");
throw;
}
finally
{
if (dataReader != null)
{
dataReader.Close();
dataReader.Dispose();
}
}
//return the arraylist as an array.
return (B.Products.Product[])
prodList.ToArray(typeof(B.Products.Product));
}
Pr_Ssp_ProductByS returns a bunch of products and all the columns for each
product from our Product table.
So I'm thinking do something like this to start off
Product[] MprodArray = B.Products.Product.GetAllProductsByS(s.SID);
So, should I use a datareader, dataset, datatable, array, or hashtable to
iterate through the results returned from my stored proc above? Since the
method returns an array, I'm not sure then what to use after this. I want to
do something like this:
for each product in the returned array
split out the productIDs out of the Product's description using regex or
something
then insert the new ProductID/Related ProductID into ProductRelationship
table
next
--
dba123 2 2357
"dba123" <db****@discussions.microsoft.comwrote in message
news:D7**********************************@microsof t.com...
Note, I'm using C#
I am wondering what type of control I should use for iterating through the
set of records returned by callin this method below,
.. . ...
>Since the
method returns an array, I'm not sure then what to use after this. I want
to
do something like this:
C# Programmer's Reference
Using foreach with Arrays http://msdn.microsoft.com/library/de...witharrays.asp
David
OK, so I guess the answer is, stick with the returned array, iterate through
it and do whatever with each record. There is no need to take the returned
array and shove it into a DataSEt or something right?
--
dba123
"David Browne" wrote:
>
"dba123" <db****@discussions.microsoft.comwrote in message
news:D7**********************************@microsof t.com...
Note, I'm using C#
I am wondering what type of control I should use for iterating through the
set of records returned by callin this method below,
.. . ...
Since the
method returns an array, I'm not sure then what to use after this. I want
to
do something like this:
C# Programmer's Reference
Using foreach with Arrays http://msdn.microsoft.com/library/de...witharrays.asp
David
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: W Hoover |
last post by:
Hope someone can help with this. I have a form with about
400 objects on it - most of them fall into two types: radio buttons and text
boxes.
In the database, I have a table of values that, for...
|
by: Alfonso Morra |
last post by:
I am implementing an application which requires the storage of a large
number of items in a cache.
I have 3-tuple key reprented by a struct, as well as an n-tuple (n is
fixed) dataset, also...
|
by: gorden blom |
last post by:
Hello,
I'm working on a ASP.NET/C# school project and I'm having some
difficulties. I'm trying to extract the values of an array, and print
them to my screen. I've added the array to a...
|
by: Rob via .NET 247 |
last post by:
Ok, I'm new to .NET so I'm afraid I'm doing something stupidhere, but I'm trying to populate a DataSet manually from aDataReader, and its turning out to be ridiculously difficult.
Yes, I could use...
|
by: DS |
last post by:
Is there a way to automatically close the data reader connection? I'm using
the MS Data Access Application block to substantially {entirely} separate
the data access layer (DAL) from the business...
|
by: Filip |
last post by:
Hello all,
Is there a way to dump a DataReader into an array, or get the number of rows
so I can get my array sized.
At the moment I'm converting my DataReader into a DataTable so I can get the...
|
by: Bihn |
last post by:
I was reading about datareader which is said to be slimmer & faster then
dataset. Since the datareader have to go fetching the dat from the database
every time it need it, the data it gets then...
|
by: Mukesh |
last post by:
Hi
I am creating a web application in which I am using datagrid. In this
application I am creating a shopping cart sort of application, I have
primery keys of selected items in a array i want to...
|
by: ^MisterJingo^ |
last post by:
Hi all,
I have a form with 4 dropdownlist controls which I populate with data
from DB tables. I have a class with a method which constructs a
dataset, putting each DB table into a dataset table....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |