Ask a questionAsk a question
 

Answerupdate database from tableadapter

  • Wednesday, November 04, 2009 9:59 PMreyfon Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have  this code and I´m trying to update the database i´ve already have de data set BDHERGAIMDataSet with all my tables( tbboletines is one of them) i add a new row, and set the values of each column of the row in the table and then  try to update the database.


    It doesn´t give me any errors when I run it but it doesn´t  write nothing on the database table....
    I might be missing something but I really don´t know... Thanks  for any help!!!!





    Dim
    newvobol As BDHERGAIMDataSet.tbboletinesRow  

    newvobol =Me.BDHERGAIMDataSet.tbboletines.NewtbboletinesRow

    newvobol.idnaturaleza = 1

    newvobol.idtipoboletin = 2

    newvobol.fechaingreso = Now()

    BDHERGAIMDataSet.tbboletines.Rows.Add(newvobol)

     

     

    Me.TbboletinesTableAdapter1.Update(newvobol)

Answers

  • Friday, November 06, 2009 3:59 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Thanks for the help... Malange I have the tables within the application  not in server (yet)...

    With this help and some search online I figured it out.

    Thanks


    I am very glad you did sort it out, can you propose as answered or helpful please. so we can move on.
    Don't judge me, just Upgrade me. Thanks!
    • Marked As Answer byreyfon Friday, November 06, 2009 6:28 PM
    •  

All Replies

  • Friday, November 06, 2009 8:22 AMYiChun ChenMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Reyfon,

    I am moving this thread from Base "Visual Studio Setup and Installation" forum to the "Visual Basic General" forum, since the issue is related to VB programming. There are more VB experts in the "Visual Basic General" forum.

    Thanks
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Friday, November 06, 2009 10:15 AMCor LigthertMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Put this around it and look what happens

    Try
    Dim newvobol As BDHERGAIMDataSet.tbboletinesRow  

    newvobol =Me.BDHERGAIMDataSet.tbboletines.NewtbboletinesRow

    newvobol.idnaturaleza = 1

    newvobol.idtipoboletin = 2

    newvobol.fechaingreso = Now()

    BDHERGAIMDataSet.tbboletines.Rows.Add(newvobol)

    Me.TbboletinesTableAdapter1.Update(newvobol)



    Catch ex as exception
       Messagebox.show(ex.message)
    end Try


    Success
    Cor
  • Friday, November 06, 2009 1:45 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    Do you have the table in your server?if that is the case you need a command_builder = to update you table. that code is not enough.


    I gonna shou something and you can change it:
    
    Dim command_builder As OleDbCommandBuilder 
    
    ' Create the DataAdapter.
    
    data_adapter =New OleDbDataAdapter(ok, connectionString) 
    
     
    ' Map Table to Contacts.
    
    data_adapter.TableMappings.Add("Table", "STUDENT") 
    
     ' Make the CommandBuilder generate the
    
    ' insert, update, and delete commands.
    
    command_builder =New OleDbCommandBuilder(data_adapter)
    
    data_adapter.Update(mydaaset)
  • Friday, November 06, 2009 2:25 PMreyfon Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks for the help... Malange I have the tables within the application  not in server (yet)...

    With this help and some search online I figured it out.

    Thanks

  • Friday, November 06, 2009 3:59 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Thanks for the help... Malange I have the tables within the application  not in server (yet)...

    With this help and some search online I figured it out.

    Thanks


    I am very glad you did sort it out, can you propose as answered or helpful please. so we can move on.
    Don't judge me, just Upgrade me. Thanks!
    • Marked As Answer byreyfon Friday, November 06, 2009 6:28 PM
    •