Solved

cannot update the actual database

Posted on 2007-11-18
6
172 Views
Last Modified: 2013-11-26
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
Comment
Question by:rolltide0
  • 3
  • 3
6 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 20309186
Hi rolltide0;

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

Form1.CUSTOMERTableAdapter.Update()

Fernando
0
 

Author Comment

by:rolltide0
ID: 20309294
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
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 20309801
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:rolltide0
ID: 20320316
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
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 20320820
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
 

Author Closing Comment

by:rolltide0
ID: 31409838
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question