Problem Returning a Dataset

S

Sparky Arbuckle

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

A real math problem. 5
How to bind a label to a dataset with C# 4
Java matrix problem 3
DataSet Problem 2
String Builder 0
Fill method for Dataset 3
Charset problem (dataset to excel) 2
Dataset Designer problems 0

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top