Solved

Binding Navigator Not Working

Posted on 2010-11-25
8
1,136 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now