By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

update in DB using stringbuilder,datarelations

P: 21
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").ToString() & ",") 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
Expand|Select|Wrap|Line Numbers
  1.  Private Sub updlog()
  2.         Dim dsRel As New DataSet
  3.         dsRel.Tables.Add(log2)
  4.         dsRel.Tables.Add(log3)
  5.         dsRel.Relations.Add("upd", dsRel.Tables("log2t2").Columns("userid"), dsRel.Tables("log3t3").Columns("userid"))
  6.         Dim drRel As DataRow
  7.         Try
  8.             Dim sb As New StringBuilder
  9.             For Each dr As DataRow In dsRel.Tables("log3t3").Rows
  10.                 For Each dc As DataColumn In dsRel.Tables("log3t3").Columns
  11.                     If dc.ToString.Equals("userid") And dc.ToString.Equals("custno") Then
  12.                         drRel = dr.GetParentRow("upd")
  13.                         sb.Append(drRel.Item("iid").ToString() & ",")
  14.                         sb.Append(drRel.Item("status").ToString() & ",")
  15.                         sb.Append(drRel.Item("message").ToString() & ",")
  16.                     Else
  17.                         sb.Append(dr(dc).ToString() & ",")
  18.                     End If
  19.                 Next
  20.                 sb.Remove(sb.Length - 1, 1)
  21.                 sb.Append(vbCrLf)
  22.             Next
  23.             'File.WriteAllText(fileggName, sb.ToString())
  24.         Catch ex As Exception
  25.             MessageBox.Show(ex.ToString)
  26.             Throw New Exception(ex.ToString)
  27.         Finally
  28.             'delete the file after retrieval
  29.             'File.Delete(Path.GetDirectoryName(filename) & "\schema.ini")
  30.         End Try
  31.     End Sub
Thanks in advance
Nov 30 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.