469,283 Members | 2,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

How to pass SqlDataReader row

Hi All,

I have the following code

------------------------------------------------
Business.Prod prod = new Business.Prod();
SqlDataReader Product = prod.GetProducts();

while (prod.Read())
{
Response.Write(BuildProduct("PASS THE ROW");
}
private string BuildProduct("ACCEPT ROW")
{
//"READ COLUMNS IN ROW"
}
------------------------------------------

Basically, I want to read every row and pass it to the BuildProduct method.
I am not sure how to pass the row, accept it and read the columns.

Please help.

Thanks in Advance.
Nov 19 '05 #1
3 2981
have you tried using DataRow as an argument to the 'BuildProduct' procedure
and then in loop through the columns.
"msnews" <an******@yahoo.com> wrote in message
news:uX*************@TK2MSFTNGP10.phx.gbl...
Hi All,

I have the following code

------------------------------------------------
Business.Prod prod = new Business.Prod();
SqlDataReader Product = prod.GetProducts();

while (prod.Read())
{
Response.Write(BuildProduct("PASS THE ROW");
}
private string BuildProduct("ACCEPT ROW")
{
//"READ COLUMNS IN ROW"
}
------------------------------------------

Basically, I want to read every row and pass it to the BuildProduct
method.
I am not sure how to pass the row, accept it and read the columns.

Please help.

Thanks in Advance.

Nov 19 '05 #2
prod.GetValues?

Ray at work

"msnews" <an******@yahoo.com> wrote in message
news:uX*************@TK2MSFTNGP10.phx.gbl...
Hi All,

I have the following code

------------------------------------------------
Business.Prod prod = new Business.Prod();
SqlDataReader Product = prod.GetProducts();

while (prod.Read())
{
Response.Write(BuildProduct("PASS THE ROW");
}
private string BuildProduct("ACCEPT ROW")
{
//"READ COLUMNS IN ROW"
}
------------------------------------------

Basically, I want to read every row and pass it to the BuildProduct
method.
I am not sure how to pass the row, accept it and read the columns.

Please help.

Thanks in Advance.

Nov 19 '05 #3
msnews wrote:
while (prod.Read())
{
Response.Write(BuildProduct("PASS THE ROW");
}
Try:
while (prod.Read())
{
Response.Write(BuildProduct(prod);
}
private string BuildProduct("ACCEPT ROW")
{
//"READ COLUMNS IN ROW"
}


and:
private string BuildProduct(IDataReader dr)
{
// return value in column called col1
return dr["col1"].ToString();
}

Have fun!
Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ricola ! | last post: by
9 posts views Thread by Jay Douglas | last post: by
3 posts views Thread by Neil Guyette | last post: by
1 post views Thread by Arvind P Rangan | last post: by
1 post views Thread by me | last post: by
5 posts views Thread by =?Utf-8?B?SkI=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.