Solved

Binding Navigator Not Working

Posted on 2010-11-25
8
1,156 Views
Last Modified: 2012-05-10
vb.net 2008
sql server express 2005 sp3

Did I miss something.
I just created a Data Source to my sql server express table
Created a form.
Dragged my datasource node code to the form.
The dataset and binding navigator toolbar  was created.

But the records are not deleting or adding to the sql server database ?
The only code I see behind the buttons is the save button. code ???

Did I miss a step somewhere...
I thought the code to saving a record , saving, was added automatically during design mode.


Thannks
fordraiders


 
0
Comment
Question by:fordraiders
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 34215716
Hi,

Probably following code will be there on you Code Behind file

    Private Sub BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorSaveItem.Click
        Me.Validate()
        Me.BindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DataSet)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'IGMS_MasterDataSet.IGMS_Company' table. You can move, or remove it, as needed.
        Me.TableAdapter.Fill(Me.DataSet.IGMS_Company)
    End Sub

Open in new window


If yes, you are not missing anything, but do you press Save button after Deleting Record?

If you don't click on Save after Deleting record, it will not delete record.

- Deepak Lakkad
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34216479
To save, add and update data from local datasource to database need to code. The controls only update/add/delete data from local source (dataset, datatable).
0
 
LVL 3

Author Comment

by:fordraiders
ID: 34217350
Patel,
OK.Where are examples of this to finish it out..from locasource to database ?
 Thanks
fordraiders
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34218480
Add a messagebox and load which shows the Update and Delete commands of the adapter.

msgbox(tableadaptername.UpdateCommand.CommandText)

Do you have a primary key in the Select statement or the column list?
0
 
LVL 3

Author Comment

by:fordraiders
ID: 34219459
CodeCruiser, Thanks for replying.
I have a primary key..., I guess I was assuming it worked the same as MsAccess... It writes directly to the data table and saves....it sounds as if this is is what it is doing in sql server express.?

I added this ?:
' for adding a new record..
 Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        TblMainDataBindingSource.AddNew()
    End Sub

So would I use the bindingsource.. to do all the saving into sql express table.. ?

Thanks
fordraiders
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34219505
I think you would use tableadaptor.updateall() function.
0
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 500 total points
ID: 34220729

Hi

Pls. check value of "Copy to Output Directory" property of your Database.

It may be "Copy if New".

This will copy your database into "bin" folder every time you run the project.

When you delete records, it will be delete from database which is in "bin" directory.

Again, when you run the project, it will copy old database in which data is not changed.

Check it out


- Deepak Lakkad
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 34234442
That was it Thanks !
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
get column names from table in vb.net 8 52
ASP/VB email question 4 46
VB.NET 2008 Publish Error 2 34
.NET 2008 VB and C# 6 39
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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