500 Points: How to make 3rd level of Drill Down Datagrid editable

Please reference this question:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21473152.html

I need get the solution that we came up with in that solution to be able to edit the third level of the nested or drill down datagrid.  Please let me know if you have questions.

Thanks!

Muligan
muliganAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

muliganAuthor Commented:
Chaosian,

1. Does not rebind to which grid?
2. Are you updating both the local copy of the dataset and the data on the server before rebinding?
2a. If you think you are updating the database, does the database data actually change?

The third level does not rebind.  I'm not sure if the dataset is updating, but the database does reflect the changes...so that is working.
Jeff CertainCommented:
Okay... let's see the code you're using to bind your datagrids...
muliganAuthor Commented:
Chaosian, does it matter that both the first and second datagrid has an id of "HG1"?
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

muliganAuthor Commented:
And... just to confirm... I put this code:

Dim dgi As DataGridItem = CType(Me.BindingContainer, DataGridItem)
            If (Not (TypeOf dgi.DataItem Is DataSet)) Then
                Throw New ArgumentException("Please change the TemplateDataMode attribute to 'Table' in the HierarGrid declaration - Part 2")
            End If
            Dim ds As DataSet = CType(dgi.DataItem, DataSet)
            HG1.DataSource = ds
            HG1.DataMember = "CustomerList"
            HG1.DataBind()

            Dim index As Integer
            If Not IsNothing(Page.Request.Form.Item("HierarGrid_ExpandedIDs_HG1")) Then
                Dim openControl = Page.Request.Form.Item("HierarGrid_ExpandedIDs_HG1")
                Dim start As Integer = openControl.IndexOf("__") + 5          ' note, you may want to find the ID of hierargridId here to make this more robust
                Dim finish As Integer = openControl.IndexOf("_Icon")
                index = Integer.Parse(openControl.Substring(start, finish - start)) - 2
                HG1.RowExpanded(index) = True
            End If


in both the first level (.aspx) & second level (.ascx) ONLY.
Jeff CertainCommented:
well... it's a good idea to have unique IDs so that the compiler knows what object to reference....
Jeff CertainCommented:
Okay... where's your code to rebind the third level datagrid (the one being edited)? And the code that you're calling to update the database (the whole function, please)...
muliganAuthor Commented:
Here is the first level databind:

Dim strConnection As String = ConfigurationSettings.AppSettings("CONNECTION_STRING_MYSQL")

            Dim strSQLcommand As String = "dbo.vw_VPView"

            Dim objConnection As New SqlConnection(strConnection)
            Dim objCommand As New SqlCommand(strSQLcommand, objConnection)

            Dim ds As DataSet = New DataSet
            objConnection.Open()

            Dim adap As SqlDataAdapter = New SqlDataAdapter(objCommand)
            adap.Fill(ds)

            objConnection.Close()

            ds.Tables(0).TableName = "SalesRepList"
            ds.Tables(1).TableName = "CustomerList"
            ds.Tables(2).TableName = "ContractList"

            'create the relations for the sample data
            Dim dc1 As DataColumn
            Dim dc2 As DataColumn

            'Relation Author => Title
            dc1 = ds.Tables(0).Columns("SubmitBy")
            dc2 = ds.Tables(1).Columns("SubmitBy")
            Dim dr As DataRelation = New DataRelation("SalesRep_Customer", dc1, dc2, False)
            ds.Relations.Add(dr)

            'Relation Title => Sales
            dc1 = ds.Tables(1).Columns("Customer")
            dc2 = ds.Tables(2).Columns("Customer")
            dr = New DataRelation("Customer_Contract", dc1, dc2, False)
            ds.Relations.Add(dr)


            'bind the DataSet to the HierarGrid
            HG1.DataSource = ds
            HG1.DataMember = "SalesRepList"
            HG1.DataBind()

            HG1.RowExpanded(0) = False

            Dim index As Integer
            If Not IsNothing(Page.Request.Form.Item("HierarGrid_ExpandedIDs_HG1")) Then
                Dim openControl = Page.Request.Form.Item("HierarGrid_ExpandedIDs_HG1")
                Dim start As Integer = openControl.IndexOf("__") + 5          ' note, you may want to find the ID of hierargridId here to make this more robust
                Dim finish As Integer = openControl.IndexOf("_Icon")
                index = Integer.Parse(openControl.Substring(start, finish - start)) - 2
                HG1.RowExpanded(index) = True
            End If
muliganAuthor Commented:
Here is the third level:

        Dim dgi As DataGridItem = CType(Me.BindingContainer, DataGridItem)

        Dim ds As DataSet = CType(dgi.DataItem, DataSet)

        DG1.DataSource = ds
        DG1.DataMember = "ContractList"
        DG1.DataBind()
muliganAuthor Commented:
To tell you about the behavior a little bit:

If I make a change in the third level that page refreshes and the datagrid does not change, but if I continue on when a second change and click one of the buttons, the page refreshes and the datagrid then displays the changes attempted on the first change, but not the second...and so on.
muliganAuthor Commented:
Chaosian,

Did I lose you?  Several days now you told me that I shouldn't flander about.. and focus on one solution.  I'm wondering if you still feel that way?

I am going to give up on finding a solution for this problem.  I am moving on to a totally different way of presenting my data.  I appreciate the help from past question that you helped on.

Administrator, please delete this question.

Regards,

Muligan
Jeff CertainCommented:
I'm still here. I was waiting for the code to be posted to show how you're editing the data: "And the code that you're calling to update the database (the whole function, please)..."
Jeff CertainCommented:
BTW, if you want hte question deleted, you'll need to post the request in Community Support
muliganAuthor Commented:
Hi... there you are.  I thought that is what I posted?  I guess I don't know what code your looking for then?  
Jeff CertainCommented:
I'm specifically looking for the code where you write the changes to the database. Most likely either using dataAdapter.Update or using an UPDATE statement in a SQL query.
muliganAuthor Commented:
I emailed Denis Bauer, and he didn't even sound as if it would be real easy to do the edits on the third level.  He said it would be "real awkward"...haha... hows that... coming from the author of the original hieragrid?  I guess that doesn't invoke a lot of confidence.  If you know what I mean.
Jeff CertainCommented:
Yeah. He also told me that it was difficult to extend the functionality so that child templates were always shown. (I wanted to do this so that my child template could add new records, even when none existed.) Took me maybe a half-day... and that includes trying to translate between C# and the VB syntax I'm familiar with.

Not that he doesn't know what he's doing -- I just get the impression that he's pretty busy and has moved on to bigger and better things.
muliganAuthor Commented:
I posted this piece of code in the other question...that I closed yesterday... so I thought you had it:

    Sub DG1_command(ByVal sender As System.Object, ByVal e As DataGridCommandEventArgs) Handles DG1.ItemCommand

        Dim SubmitID As Int32
        Dim ApprovedType As String
        Dim SubmitEmail As String
        Dim ApprovedDate As Date
        Dim ApprovedBy As String = Replace(Replace(System.Web.HttpContext.Current.Request.ServerVariables("LOGON_USER").ToUpper, "\", ""), "_", " ")

        If (e.CommandName = "Delete") Then

            ApprovedType = "Rejected"
            ApprovedDate = Today()
            SubmitID = Convert.ToString(CType(e.Item.FindControl("SubmitID"), TextBox).Text)
            SubmitEmail = Convert.ToString(CType(e.Item.FindControl("SubmitEmail"), TextBox).Text)

            'Prepare SQL string
            Dim commandString As New System.Text.StringBuilder
            commandString.Append("UPDATE ContractRegular_SpecialPricing_New SET ")
            commandString.Append("ApprovedType='" & ApprovedType & "',")
            commandString.Append("ApprovedDate='" & ApprovedDate & "',")
            commandString.Append("ApprovedBy='" & ApprovedBy & "' ")
            commandString.Append("WHERE SubmitID=" & SubmitID)

            'Send to DB and execute
            performDBOperation(commandString.ToString)

        End If

        If (e.CommandName = "Approve") Then

            ApprovedType = "Approved"
            ApprovedDate = Today()
            SubmitID = Convert.ToString(CType(e.Item.FindControl("SubmitID"), TextBox).Text)
            SubmitEmail = Convert.ToString(CType(e.Item.FindControl("SubmitEmail"), TextBox).Text)

            'Prepare SQL string
            Dim commandString As New System.Text.StringBuilder
            commandString.Append("UPDATE ContractRegular_SpecialPricing_New SET ")
            commandString.Append("ApprovedType='" & ApprovedType & "',")
            commandString.Append("ApprovedDate='" & ApprovedDate & "',")
            commandString.Append("ApprovedBy='" & ApprovedBy & "' ")
            commandString.Append("WHERE SubmitID=" & SubmitID)

            'Send to DB and execute
            performDBOperation(commandString.ToString)

        End If

    End Sub
muliganAuthor Commented:
By the way... my third level of my datagrid is not staying open like I thought it was (yesterday's open question).  The page was refreshing so quick I didn't notice that i was opening a totally different third level of information.  So I went back and looked thru you suggestions about having to rename the "HierarGrid_ExpandedIDs_HG1" to "HG2"... and so on... well that didn't work.  And when I looked at the source code... the second level datagrid seemed to have a name like this instead: "HierarGrid_ExpandedIDs_HG1__ctl2_ChildTemplate_CustomerList_HG2", but when I instert that name into your function where "HierarGrid_ExpandedIDs_HG1" is currently located... the whole application dies.

So in short... that problem was never fixed either.   So  after days of focusing on a problem... I seem to be no closer to a resolution.  I'm just real frustrated...as I'm sure you are as well.  I'm just not sure how much more time I should invest into this when I seem to be chasing my tail around in circles.  Thoughts?
Jeff CertainCommented:
So... just so I understand... DG1 is the third level datagrid?

At the end of the code above, you need to do one of two things:
1. Retrieve the table from the database again and bind DG1 to the refreshed table.
OR
2. Write the changes to the row and rebind the datagrid.

The code to find and update your data row will look like this:
Dim id as Integer =Ctype(source,DataGrid).DataKeys(e.Item.ItemIndex)
Dim row as DataRow = ds.Tables("insert table name here").Select("Id=" & Id)(0)
row("ApprovedType") = ' new value
row("ApprovedDate") = 'new value
' etc
row.AcceptChanges
ds.Tables("table name").AcceptChanges()
DG1.DataSource = ds.Tables("table name")
DG1.DataBind

** note: I'm assuming your data source is a dataset that is accessible from DG1_Command. Generally, my datasets tend to be stored in session variables, so they're easily accessible.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeff CertainCommented:
Let me look at this over the weekend...
muliganAuthor Commented:
Thanks... let me know if you figure something out.
muliganAuthor Commented:
Just got another email from denis.. here is what he had to say:

is there a difference between doing the edits on 2nd, 3rd or any other level? It is more a problem to merge them back into the main dataset. If you can get your change events in the 3rd level and need to update your main dataset, I'd recommend having a property on the Page that exposes this dataset.

public class XYPage Inherits Page
    public property MyData as dataset
        get
            ...
        end get
    end property
end class
 
public class MyChildTemplate inherits UserControl
 
    public sub SaveButton_Click() handles MyPostButton.Click
        ctype(this.Page, XYPage).MyData.Tables[0].Rows[x]["XYColumn"] = postedvalue
    end sub
 
end class

Hope this helps you?

Muligan
muliganAuthor Commented:
Here is another suggestion of his:

Another way would be to publish a property and use FindControl to acquire the child template.

c=HierarGrid1.Items[i].Cells[1].FindControl("DCP").FindControl("Panel").FindControl("Panel_[PanelId]").FindControl("ChildTemplate_[PanelId]").FindControl("[InnerControlId]");

Not sure what all of that means....
Jeff CertainCommented:
muligan,

Prepare to copy. Over.

Here's what I did....
1. Created a new Access database. Created 3 tables that basically had table Id, parent Id, and a description. Specifically:
Table 1: Table1Id, Description
Table 2: Table2Id, Table1Id, Description
Table 3: Table3Id, Table2Id, Description, Status

2. Filled the tables with some bogus data.

3. Granted read/write permission to the ASPNET user account.

4. Created a new web application.

4. Added a "templates" folder. Added child.ascx and grandchild.ascx to the template folder.

5. Created "images" folders in both the root and templates folders, and put the plus.gif and minus.gif files in each "images" folder.

6. Left all hierargrids autogeneratecolumns = true. Set bound columns for the datagrid on grandchild.ascx. Included Accept and Reject buttons. Coded edit functionality.

7. Tested to ensure that children and grandchildren were wired to the appropriate parents. Tested accept/reject buttons.

8. Wired up code to ensure parent's children were visible. Assumption: only one child expanded at a time. Since expanded IDs are a comma-delimited string, it's an easy step to extend this functionality for the case where multiple children are expanded.

What I didn't do: Finish ensuring that grandchildren are expanded. Since you indicated that you had this under control already, I didn't think it was worth chasing too long.

Code follows.

Jeff CertainCommented:
WebForm1 HTML:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Editor.WebForm1" %>
<%@ Register TagPrefix="dbwc" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>WebForm1</title>
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
      </HEAD>
      <body MS_POSITIONING="GridLayout">
            <form id="Form1" method="post" runat="server">
                  <DBWC:HIERARGRID id="hgParent" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
                        TemplateDataMode="Table"></DBWC:HIERARGRID></form>
      </body>
</HTML>

WebForm1.vb:
Imports System.Data.OleDb

Public Class WebForm1
      Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

      'This call is required by the Web Form Designer.
      <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

      End Sub
      Protected WithEvents hgParent As DBauer.Web.UI.WebControls.HierarGrid

      'NOTE: The following placeholder declaration is required by the Web Form Designer.
      'Do not delete or move it.
      Private designerPlaceholderDeclaration As System.Object

      Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
      End Sub

#End Region

      Friend ReadOnly Property ds() As DataSet
            Get
                  If Session("data") Is Nothing Then
                        Session("data") = GetData()
                  End If
                  Return Session("data")
            End Get
      End Property

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            BindData()
      End Sub

      Private Sub BindData()
            With hgParent
                  .DataSource = ds.Tables(0)
                  .DataKeyField = "Table1Id"
                  .DataBind()
            End With

            ' Expand the children controls
            With Page.Request.Form
                  If Not IsNothing(.Item("HierarGrid_ExpandedIDs_hgParent")) Then
                        Dim hgParentExpand As String = .Item("HierarGrid_ExpandedIDs_hgParent")
                        hgParentExpand = hgParentExpand.Substring(hgParentExpand.IndexOf("__ctl") + 5)
                        hgParentExpand = hgParentExpand.Substring(0, hgParentExpand.IndexOf("_Icon"))
                        hgParent.RowExpanded.Item(Integer.Parse(hgParentExpand) - 2) = True
                  End If
            End With
      End Sub

      Private Function GetData() As DataSet
            Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Jeff\Desktop\Test.mdb")
            Dim strSQL As String = "SELECT * FROM Table1"
            Dim cmd As New OleDbCommand(strSQL, conn)
            Dim adapt As New OleDbDataAdapter(cmd)
            GetData = New DataSet

            Try
                  GetData.Tables.Add("Parent")
                  adapt.Fill(GetData.Tables("Parent"))

                  strSQL = "SELECT * FROM Table2"
                  cmd = New OleDbCommand(strSQL, conn)
                  adapt = New OleDbDataAdapter(cmd)
                  GetData.Tables.Add("Child")
                  adapt.Fill(GetData.Tables("Child"))

                  strSQL = "SELECT * FROM Table3"
                  cmd = New OleDbCommand(strSQL, conn)
                  adapt = New OleDbDataAdapter(cmd)
                  GetData.Tables.Add("GrandChild")
                  adapt.Fill(GetData.Tables("GrandChild"))
            Catch ex As Exception
                  Throw ex
            Finally
                  adapt.Dispose()
                  cmd.Dispose()
                  If conn.State = ConnectionState.Open Then conn.Close()
                  conn.Dispose()
            End Try

            'Add data relations
            With GetData
                  Dim dr1 As New DataRelation("ParentChild", .Tables("Parent").Columns("Table1Id"), _
                   .Tables("Child").Columns("Table1Id"))
                  .Relations.Add(dr1)
                  Dim dr2 As New DataRelation("ChildGrandchild", .Tables("Child").Columns("Table2Id"), _
                   .Tables("GrandChild").Columns("Table2Id"))
                  .Relations.Add(dr2)
            End With

            Return GetData
      End Function

      Private Sub hgParent_TemplateSelection(ByVal sender As Object, ByVal e As DBauer.Web.UI.WebControls.HierarGridTemplateSelectionEventArgs) Handles hgParent.TemplateSelection
            ' Set the child template
            e.TemplateFilename = "Templates\Child.ascx"
      End Sub
End Class

Templates/Child.ascx HTML:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Child.ascx.vb" Inherits="Editor.Child" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="dbwc" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
<DBWC:HierarGrid id="hgChildren" runat="server" TemplateDataMode="Table"></DBWC:HierarGrid>

VB:
Public Class Child
    Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

      End Sub
      Protected WithEvents hgChildren As DBauer.Web.UI.WebControls.HierarGrid

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

      Private ReadOnly Property ds() As DataSet
            Get
                  Return CType(Me.Parent.Page, WebForm1).ds
            End Get
      End Property

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
      End Sub

      Private Sub Page_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.DataBinding
            BindData()
      End Sub

      Public Sub BindData()
            With hgChildren
                  Dim dgi As DataGridItem = CType(Me.BindingContainer, DataGridItem)
                  .DataSource = CType(dgi.DataItem, DataSet)
                  .DataMember = "Child"
                  .DataKeyField = "Table2Id"
                  .DataBind()
            End With
      End Sub

      Private Sub hgChildren_TemplateSelection(ByVal sender As Object, ByVal e As DBauer.Web.UI.WebControls.HierarGridTemplateSelectionEventArgs) Handles hgChildren.TemplateSelection
            ' Set the child template
            e.TemplateFilename = "Templates\GrandChild.ascx"
      End Sub
End Class


Templates/Grandchild.ascx HTML:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Grandchild.ascx.vb" Inherits="Editor.Grandchild" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="dbwc" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
<P><asp:datagrid id="dgGrandchild" runat="server" AutoGenerateColumns="False">
            <Columns>
                  <asp:ButtonColumn Text="Accept" CommandName="Accept"></asp:ButtonColumn>
                  <asp:ButtonColumn Text="Reject" CommandName="Reject"></asp:ButtonColumn>
                  <asp:BoundColumn DataField="Table2Id" HeaderText="Table2Id"></asp:BoundColumn>
                  <asp:BoundColumn DataField="Table3Id" ReadOnly="True" HeaderText="Table3Id"></asp:BoundColumn>
                  <asp:BoundColumn DataField="Table3Desc" HeaderText="Table3Desc"></asp:BoundColumn>
                  <asp:BoundColumn DataField="Status" HeaderText="Status"></asp:BoundColumn>
            </Columns>
      </asp:datagrid></P>


Grandchild VB:
Imports System.Data.OleDb

Public Class Grandchild
      Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

      'This call is required by the Web Form Designer.
      <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

      End Sub
      Protected WithEvents dgGrandchild As System.Web.UI.WebControls.DataGrid

      'NOTE: The following placeholder declaration is required by the Web Form Designer.
      'Do not delete or move it.
      Private designerPlaceholderDeclaration As System.Object

      Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
      End Sub

#End Region

      Private ReadOnly Property ds() As DataSet
            Get
                  Return CType(Me.Parent.Page, WebForm1).ds
            End Get
      End Property

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
      End Sub

      Private Sub Page_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.DataBinding
            BindData()
      End Sub

      Public Sub BindData()
            With dgGrandchild
                  Dim dgi As DataGridItem = CType(Me.BindingContainer, DataGridItem)
                  .DataSource = CType(dgi.DataItem, DataSet)
                  .DataMember = "GrandChild"
                  .DataKeyField = "Table3Id"
                  .DataBind()
            End With
      End Sub

      Private Sub dgGrandchild_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgGrandchild.ItemCommand
            Dim table3Id As Integer = CType(source, DataGrid).DataKeys(e.Item.ItemIndex)
            Dim row As DataRow = ds.Tables(2).Select("Table3Id=" & table3Id)(0)
            Dim status As String
            Select Case e.CommandName
                  Case "Accept"
                        status = "Accepted"
                  Case "Reject"
                        status = "Rejected"
            End Select

            If status.Length > 0 Then
                  SetValue(row("Table3Id"), status)
                  row("Status") = status
                  row.AcceptChanges()
                  ds.Tables(2).AcceptChanges()
                  BindData()
            End If
      End Sub

      Private Sub SetValue(ByVal id As Integer, ByVal value As String)
            Dim strSQL As String = "UPDATE Table3 SET Status='" & value & "' WHERE Table3Id=" & id
            Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Jeff\Desktop\Test.mdb")
            Dim cmd As New OleDbCommand(strSQL, conn)

            Try
                  conn.Open()
                  cmd.ExecuteNonQuery()
            Catch ex As Exception
                  Throw ex
            Finally
                  conn.Close()
            End Try
      End Sub
End Class
muliganAuthor Commented:
Great job... thank you.
Jeff CertainCommented:
Glad we finally got it.
Jeff
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.