sj1187534 Posted July 23, 2003 Posted July 23, 2003 Here's the code I am trying to work on: Private Function CustomizeDataSet(ByRef ds As DataSet) As DataSet Dim rowCount As Integer, newDs As New DataSet Dim dt As New DataTable newDs.Tables.Add(dt) For rowCount = 0 To ds.Tables(0).Rows.Count - 1 Dim newDr As DataRow If Not rowCount = 0 Then Dim colCount As Integer For colCount = 0 To ds.Tables(0).Columns.Count - 1 newDr = dt.NewRow If Not ds.Tables(0).Columns(colCount).ColumnName = "Title" Then newDr.Item(colCount - 1) = ds.Tables("Jobs").Rows(rowCount).Item(colCount) Else Dim hypDesc As New HyperLink hypDesc.Text = ds.Tables("Jobs").Rows(rowCount).Item(colCount) hypDesc.NavigateUrl = "JobInfo.aspx?id=" & ds.Tables("Jobs").Rows(rowCount).Item(0) newDr(colCount - 1) = hypDesc ------------> Error is here <---------------- End If dt.Rows.Add(newDr) Next End If Next Cache("Jobs") = newDs Return newDs End Function =========================================== What I am doing here is creating a new dataset 'newDs' from a dataset 'ds'. When I am running this code, it is giving me an error on the line shown above. It says that it cannot find the column 0.....Is there any other way to handle this. Thanks, SJ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.