Results 1 to 3 of 3

Thread: VB2005: Oracle tbl -> vb 2005 data tbl -> Oracle tbl

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Location
    Oakland, Ca
    Posts
    3

    VB2005: Oracle tbl -> vb 2005 data tbl -> Oracle tbl

    Hello, code gurus. I would be soooo grateful if anyone could help me with question.

    I have a dataset created from a SQL query on an Oracle db. How do I write back the data, in Table = "Results0", to Oracle?

    Code:
    Private Sub pbResetRowID_Click(...)
    
         '` Get data from Oracle
         Dim strSQL As String = "SELECT * FROM TABLE_AB"
    
         Dim objcommand As New OleDb.OleDbCommand(strSQL, objConnection)
         Dim objdataadapter As New OleDb.OleDbDataAdapter(objcommand)
    
         '` Save results locally
         Dim objdatatable As New Data.DataTable("Results0")
         objdataadapter.Fill(objdatatable)
    
         Dim objDataRow As DataRow
    
         ' Seed the index
         Dim nIdx As Int32 = 100
    
         '` Walk down the rows
         For Each objDataRow In objdatatable.Rows
              '` Assign index
              objDataRow.Item("IDX") = nIdx
    
              '` Bump up index value
              nIdx += 10
         Next
    
         '------------------------------------------
         '    Ok, now save the datatable in Oracle!
         '------------------------------------------

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: VB2005: Oracle tbl -> vb 2005 data tbl -> Oracle tbl

    I don't use that method but I think you use a command builder to create the insert,update and delete statements for the dataset.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Location
    Oakland, Ca
    Posts
    3

    Re: VB2005: Oracle tbl -> vb 2005 data tbl -> Oracle tbl

    Hi Gary,

    Thanks for the suggestion. I am using this method because I want to step through the returned data set which you cannot do (as far as I can tell) when using a standard (SELECT, INSERT, DELETE, UPDATE) query in the design view.

    I am a VB 2005 newbie so may be completely mistaken in my belief!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width