[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Binding Navigator Not Working

Posted on 2010-11-25
8
Medium Priority
?
1,231 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

872 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