G
Gary
I have a date field in a Dataset. I need to change the
date field for display purposes so I would like to loop
through the dataset and modify the field before I bind it
to a grid. Here is the code I have so far:
--------------------------------------------------
Dim cmdstring As String = "Select [date], [time],
endtime, [desc], con_id from Notes where con_id = '" &
Label3.Text & "'"
Dim da As New SqlClient.SqlDataAdapter
Dim ds As New DataSet
Dim drCurrent As System.Data.DataRow
Dim daNotes1 As New SqlClient.SqlDataAdapter
(cmdstring, Me.SqlConnection2)
daNotes1.Fill(ds, "Notes")
Dim RowLoopIndex As Integer
ListBox1.Items.Clear()
ListBox2.Items.Clear()
'
' I would like to modify the field here and then
add the item to
' a listbox so I can see the results of each
field I modified.
'
For RowLoopIndex = 0 To (ds.Tables
("Notes").Rows.Count - 1)
ListBox1.Items.Add(ds.Tables("Notes").Rows
(RowLoopIndex).Item(0))
Next
Me.DG_Notes.DataSource = ds
Me.DG_Notes.DataMember = "Notes"
----------------------------------------------------
My question is how can I change the item and have it
update the table? When I bind to the Datagrid at the
end, I would like to see the results.
Any help and code examples, placement would be greately
appreciated.
Thanks,
Gary
date field for display purposes so I would like to loop
through the dataset and modify the field before I bind it
to a grid. Here is the code I have so far:
--------------------------------------------------
Dim cmdstring As String = "Select [date], [time],
endtime, [desc], con_id from Notes where con_id = '" &
Label3.Text & "'"
Dim da As New SqlClient.SqlDataAdapter
Dim ds As New DataSet
Dim drCurrent As System.Data.DataRow
Dim daNotes1 As New SqlClient.SqlDataAdapter
(cmdstring, Me.SqlConnection2)
daNotes1.Fill(ds, "Notes")
Dim RowLoopIndex As Integer
ListBox1.Items.Clear()
ListBox2.Items.Clear()
'
' I would like to modify the field here and then
add the item to
' a listbox so I can see the results of each
field I modified.
'
For RowLoopIndex = 0 To (ds.Tables
("Notes").Rows.Count - 1)
ListBox1.Items.Add(ds.Tables("Notes").Rows
(RowLoopIndex).Item(0))
Next
Me.DG_Notes.DataSource = ds
Me.DG_Notes.DataMember = "Notes"
----------------------------------------------------
My question is how can I change the item and have it
update the table? When I bind to the Datagrid at the
end, I would like to see the results.
Any help and code examples, placement would be greately
appreciated.
Thanks,
Gary