Results 1 to 7 of 7

Thread: SQL database not saving

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    133

    SQL database not saving

    I am trying to add a row to a database, i am able to put the row into the database and view it ina datagrid while the VB program is running, but when the program closes that row dissapears. What code am i missing to update the database table instead of just the working dataset?

    Code:
    Dim saverow2 As DataRow
            If saverow = 0 Then
                saverow2 = MainDBDataSet.Assesments.NewRow()
                saverow2.Item("Customer") = CustomerName
                .
                .
                .
                MainDBDataSet.Tables("assesments").Rows.Add(saverow2)
                Me.TableAdapterManager.UpdateAll(Me.MainDBDataSet)
    endif

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: SQL database not saving

    I would write a standard SQL INSERT Query to add the new record to my database.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    133

    Re: SQL database not saving

    Where can i see and example of that? I am new to SQL.
    VB version: Visual Studio 2008-Professional

  4. #4
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: SQL database not saving

    What kind of SQL server are you running? SQL Server? MySQL? Oracle?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    133

    Re: SQL database not saving

    SQL server.
    VB version: Visual Studio 2008-Professional

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: SQL database not saving

    See the Database FAQ section on this site.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    133

    Re: SQL database not saving

    I see the database FAQ section, but i dont think i understand. From what i see what im doing should work right? Inserting the row to the dataset then updating the table via the dataset.

    The faq says to use the update method to save the changes to the database, im using the command but its not updating the database.

    Sorry for the ignorance, ive never used SQL before.
    VB version: Visual Studio 2008-Professional

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