• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

cannot update the actual database

I am having issues with a visual basic project. I am working on a sql express database. I am having the form auto generate the dataset from the database and auto setting the table adapters for me. My problem is inserting/updating the actual database. Using Form1.CUSTOMERTableAdapter.Insert (blah blah) I am able to update the dataset, but I do not know how to make it update the actual database with the new information. Any help would be appreciated.
0
rolltide0
Asked:
rolltide0
  • 3
  • 3
1 Solution
 
Fernando SotoCommented:
Hi rolltide0;

To update the database use the SQLDataAdapter's Update method as shown below.

Form1.CUSTOMERTableAdapter.Update()

Fernando
0
 
rolltide0Author Commented:
I tried that and it didnt work. It said there was no Update method that accepted zero arguments. I included the code from the sub for reference. As mentioned before, it will update the dataset, but not the actual database.
Private Sub updateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateButton.Click
        Dim TypeValue As String
        If individualButton.Checked Then TypeValue = "IND" Else TypeValue = "BUS"
 
        Form1.CUSTOMERTableAdapter.Insert(CusNumField.Text, LastNameField.Text, FirstNameField.Text, MiField.Text, Addr1Field.Text, CityField.Text, StateField.Text, ZipField.Text, HomePhoneField.Text, CellPhoneField.Text, WorkPhoneField.Text, TypeValue, Addr2Field.Text)
 
 
        updateButton.Enabled = False
 
 
 
 
 
    End Sub

Open in new window

0
 
Fernando SotoCommented:
I am learning working with database myself now. When you auto generate your SqlDataAdapter you need to configure it. This will create the Insert, Delete from the SQL Select statement which you create during the configuration set-up. If you right click on the SqlDataAdapter there should be a menu item to configure it. Follow the wizard.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
rolltide0Author Commented:
I have a dataset, binding source, table adapter, and navigator. None of them have a config wizard. There is a query builder, is that what you are referring to? If not please explain.
0
 
Fernando SotoCommented:
Look at these two web pages on configuring the TableAdapter.

TableAdapter Overview  
http://msdn2.microsoft.com/en-us/library/bz9tthwx(VS.80).aspx

TableAdapter Configuration Wizard  
http://msdn2.microsoft.com/en-us/library/dex7k4dw(VS.80).aspx
0
 
rolltide0Author Commented:
Even though this wasn't the exact fix to my problem it led me to the problem. There was  a problem accessing my sql express file, so I imported the database to a full version of sql server 2005. Then I created a login and pointed the project to that database. Been working ever since.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now