Problem Returning a Dataset

Discussion in 'ASP .Net' started by Sparky Arbuckle, Aug 18, 2005.

  1. The function below works in that it returns the correct data back to
    the dataset for 2 of the rows in my datalist:

    A1 - A - 1
    A1 - A - 2
    A1 - A - 3
    A1 - B - 1
    A1 - B - 2
    A1 - C - 1
    A1 - C - 2
    A1 - C - 3

    The above dataset is returned as A1 - C - 3

    What I would like to do is return A1 - C - C1, C2, C3

    I have done a response.write(rowCount) and the correct number of rows
    are returned. My main question is how do I go about creating the
    string on each row in the dataset? Right now the first row looks like
    A1, A2, A3, A4, A5, A6, A7, A8. This is partially correct because there
    are 8 rows being returned. How do I configure my FOR NEXT to take it
    row by row?

    Function GetNewestVersionByProductID(ByVal x As String)

    Dim objConn As New
    OleDb.OleDbConnection(ConfigurationSettings.AppSettings("strConnection"))


    Dim strSQL As String = "SELECT tblProduct.Drawing,
    tblProduct.SheetType, Max(tblProduct.ProductVersion) AS
    MaxOfProductVersion, " & _
    "Max(ProductRevision.Revision) AS MaxOfProductRevision,
    tblProduct.SheetNumber FROM tblProducts " & _
    "INNER JOIN (ADCN INNER JOIN Sheet ON ADCN.RecordID =
    tblProduct.RecordID) " & _
    "ON tblProduct.ProductID = tblRevisions.ProductID WHERE " & _
    "tblProduct.ProductID = '" & x & "' AND tblProduct.SheetType = 'SH' " &
    _
    "GROUP BY tblProduct.ProductType, tblProduct.ProductID,
    tblProduct.PageNumber;"

    Dim ds As New DataSet
    Dim objCommand As New OleDb.OleDbCommand(strSQL, objConn)
    Dim myCommand As New OleDb.OleDbDataAdapter(strSQL, objConn)
    myCommand.Fill(ds, "tblProducts")
    ds.Tables("tblProducts").Columns.Add("ProductVersionString")
    Dim i As Integer = 0
    Dim countSheetNumber As Integer = dsADCN.Tables("tblADCN").Rows.Count()

    For i = 0 To countSheetNumber - 1
    If ds.Tables("tblProducts").Rows(i)("MaxOfProductVersion") Is Nothing
    Then ds.Tables("tblProduct").Rows(i)("ProductVersionString") = "0"
    ds.Tables("tblProducts").Rows(0)("ProductVersionString") +=
    ds.Tables("tblProduct").Rows(0)("MaxOfProductVersion") & i + 1
    Next

    Return ds.Tables("tblProducts").DefaultView

    End Function
    Sparky Arbuckle, Aug 18, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Boffo Jinko

    Returning a DataSet from a Web Services

    Boffo Jinko, Nov 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,249
    Guest
    Nov 7, 2003
  2. Paul
    Replies:
    0
    Views:
    412
  3. Sumaira Ahmad
    Replies:
    2
    Views:
    414
    bruce barker
    Nov 2, 2004
  4. Replies:
    11
    Views:
    662
    Christos Georgiou
    May 2, 2006
  5. Milsnips

    problem returning dataset values with a webservice...

    Milsnips, Oct 4, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    112
    Milsnips
    Oct 4, 2004
Loading...

Share This Page