Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

LINQ -Tried to get a count to see if query returned anything

Avatar of LyndaPostal
LyndaPostalFlag for United States of America asked on
ASP.NETVisual Basic.NETMicrosoft SQL Server 2005
3 Comments1 Solution309 ViewsLast Modified:
The query results cannot be enumerated more than once
and the routine died on line
73:         Next

what I am trying to do is see if I've returned a recordset and, if not, instead of showing results, show a message to the effect that no results were returned.

I am VERY new to LINQ, watched videos on it, can't find the syntax to bind to a list (I saw the video, cannot FIND it again)... not even sure if I should try to bind to a list.

thanks for any help

Dim rs = From Product In dConn.StProc_GetDetail(Request.QueryString("pn"), Request.QueryString("cID"))
        Dim iRowCount As Integer = rs.Count
        If rs.Count > 0 Then
        End If
        For Each Product In rs
            lblDesc1.Text = Left(Product.Desc1, InStr(Product.Desc1, ":") - 1)
            imgPartDetail.ImageUrl = Product.sImageLocation
            imgPartDetail.ImageAlign = ImageAlign.Left
            lblLongDescription.Text = Product.LongDescription
            lblAmount.Text = Product.dListPrice
            lblPartNo.Text = Product.sPartNo
            lblMainTitle.Text = Product.sMainTitle
            lblQtyAtDealer.Text = Product.IQtyAtDealer
            lblBike.Text = Product.sBike
            lblBikeRecNo.Text = Product.iBikeRecNo
            lbldlrEa.Text = Product.dlrEa
            lblListPrice.Text = Product.dListPrice
            lblRetail.Text = Product.Retail
            lblSubCategoryNo.Text = Product.CategoryID
            lblCost.Text = Product.dCost
            lblCategoryNo.Text = Product.CategoryID
        Next '<-- dies here
Avatar of bhmahler
bhmahlerFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers