Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...