update in DB using stringbuilder,datarelations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • riyap
    New Member
    • Nov 2007
    • 21

    #1

    update in DB using stringbuilder,datarelations

    Hi,
    can anyone guide me how to update a access db with datatables and string builder
    im trying to update 3 columns

    does sb.Append(drRel .Item("id").ToS tring() & ",") this means im i updating the feild value into DB.
    my program is a big process
    so i just need help on update thing
    it also have select command to filter records and call the stored proc in oracle nd insert and get the o/p value and update in access

    i finished the above 2 steps but facing the problem with the update
    Please anyone guide me in correct way

    my code
    Code:
     Private Sub updlog()
            Dim dsRel As New DataSet
            dsRel.Tables.Add(log2)
            dsRel.Tables.Add(log3)
            dsRel.Relations.Add("upd", dsRel.Tables("log2t2").Columns("userid"), dsRel.Tables("log3t3").Columns("userid"))
            Dim drRel As DataRow
            Try
                Dim sb As New StringBuilder
                For Each dr As DataRow In dsRel.Tables("log3t3").Rows
                    For Each dc As DataColumn In dsRel.Tables("log3t3").Columns
                        If dc.ToString.Equals("userid") And dc.ToString.Equals("custno") Then
                            drRel = dr.GetParentRow("upd")
                            sb.Append(drRel.Item("iid").ToString() & ",")
                            sb.Append(drRel.Item("status").ToString() & ",")
                            sb.Append(drRel.Item("message").ToString() & ",")
                        Else
                            sb.Append(dr(dc).ToString() & ",")
                        End If
                    Next
                    sb.Remove(sb.Length - 1, 1)
                    sb.Append(vbCrLf)
                Next
                'File.WriteAllText(fileggName, sb.ToString())
            Catch ex As Exception
                MessageBox.Show(ex.ToString)
                Throw New Exception(ex.ToString)
            Finally
                'delete the file after retrieval
                'File.Delete(Path.GetDirectoryName(filename) & "\schema.ini")
            End Try
        End Sub
    Thanks in advance
Working...