?
Solved

BindingNavigator problem....

Posted on 2006-06-20
19
Medium Priority
?
550 Views
Last Modified: 2008-09-13
Please....

I have a form with Bindingsource, Dataset, DataAdapter and BindingNavigator...

The problem is that bindingNavigator is not flexible...So..What I want is to implement the funcionality of add, Update, delete to my data, but using storedProcedures and using the possibility, for example, to ask the user before delete a Record... Anybody can help me ? Is it possible using the bindingNavigator, But modifiyng the standard behaviour of it  ?¿ ¿


Thanks in advance

 
0
Comment
Question by:franklinan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 10

Expert Comment

by:vadim63
ID: 16943443
Of course, it is. You can remove all the standard buttons and create your own buttons, with your own queries (with Stor_proc, or whatever).
0
 
LVL 1

Author Comment

by:franklinan
ID: 16945790
please...a sample of how to call a simple stored procedure....just returning a value....
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16945848
Did you create your Dataset, DataAdapter at design time? Can you edit your DataSet with designer?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:franklinan
ID: 16945872
I've got my Dataset and DataAdapter with Designer....I can Edit the Dataset...But I don't know how to "Include" the call to Stored Procedure.....please help ! Thanks for your fast answer !
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16945958
OK, go to designer > right click on your TableAdapter > Add query > Use Existing Stored Procedure > Select the Stored Procedure from the dropdown list >  click next > check "A single value" > click next > Assign the name > Finish.
0
 
LVL 1

Author Comment

by:franklinan
ID: 16946005
um....I'm sorry but something is not ok....

In my TableAdapter actually I've a Query that is a select, which result is used by BindingSource to link with several text boxes where the data is shown....

I don't want to loose this....

One more thing : If I use right click, I don't have any option of use a Stored Procedure...just can use a Query Generator..... (I'm using VS2005)....

I'm confused,....sorry
0
 
LVL 1

Author Comment

by:franklinan
ID: 16946577
Finally I've Drag and Drop the Stored Procedure (Add new Datasource) and now  a Dataset is created...My problem is...HOW I CALL THAT ? ? ? ? ?

Please...a sample....I'm totally lost !
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16946612
If you already have a Dataset, you don't need to create another one. You can add adapters, queries to existing Dataset.
0
 
LVL 10

Accepted Solution

by:
vadim63 earned 2000 total points
ID: 16946794
Check this pictures:

http://www.treckamerica.com/ee.htm
0
 
LVL 1

Author Comment

by:franklinan
ID: 16951763
Can you put some code of how to access insert Stored procedure created ? I don't know how to do that...
0
 
LVL 1

Author Comment

by:franklinan
ID: 16951779
I can't find the stroed procedures created n the Database....Something I'm doing wrong maybe....
0
 
LVL 1

Author Comment

by:franklinan
ID: 16952295
One last question...Actually I have modified the add item on BindingNavigator with this :

Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
        T_NombreTableAdapter.SP_AddItem(NomTxt.Text, ApeTxt.Text)

    End Sub

Other Items on BindingNavigator are original....

On SAVEITEM is this :

Private Sub T_NombreBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T_NombreBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.T_NombreBindingSource.EndEdit()
        Me.T_NombreTableAdapter.Update(Me.FrankDataSet.T_Nombre)

    End Sub

Why When I click ADD after put some Values, and CLICK on SAVEI to Update the Database, the changes are not visible till I close and open the aplication again ? ?


0
 
LVL 10

Expert Comment

by:vadim63
ID: 16952339
Because you have to refill your tableadapter.

        Me.Validate()
        Me.T_NombreBindingSource.EndEdit()
        Me.T_NombreTableAdapter.Update(Me.FrankDataSet.T_Nombre)

        Me.T_NombreTableAdapter.Fill(Me.FrankDataSet.T_Nombre)
0
 
LVL 1

Author Comment

by:franklinan
ID: 16952374
um...and I have to reload all Dataset ? ?  ?...Not possible to only reload the modified/added records ?
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16952411
I don't know the way you fill it Initially
0
 
LVL 1

Author Comment

by:franklinan
ID: 16952471
Finally Works, but I would like to reload only modified/added results....any idea ?

I've got this code :



Public Class Form1
    Dim AddRecord As Boolean = False

    Private Sub T_NombreBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T_NombreBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.T_NombreBindingSource.EndEdit()
        '
        If AddRecord = True Then
            T_NombreTableAdapter.SP_Añadir(NombreTxt.Text, ApellidoTxt.Text)
        Else
            Me.T_NombreTableAdapter.Update(Me.FrankDataSet.T_Nombre)
        End If

        Me.T_NombreTableAdapter.Fill(Me.FrankDataSet.T_Nombre)
        AddRecord = False
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
        Me.T_NombreTableAdapter.Fill(Me.FrankDataSet.T_Nombre)

    End Sub

    Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
        AddRecord = True
        NombreTxt.Text = ""
        ApellidoTxt.Text = ""

    End Sub
End Class
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16952730
OK, as I can see, initially, you pull all records. So, I didn't understand, would you like to pull only one record after inserting/updating, or all records, but positioned on the last modified/added row?
0
 
LVL 10

Expert Comment

by:vadim63
ID: 16952814
And another question. What kind of control are you binding with your data? Datagridview? Textboxes?
0
 
LVL 1

Author Comment

by:franklinan
ID: 16955456
a) What I'm refering is : If I have a Dataset Loaded, why Do I need to read again all records each time I  add just one ? The best would be just to recover the new add record, because all the other are loaded on the Dataset and them have'nt been modified.


b) I have a lot of textboxes... Is it a fast way of write the call to StoredProcedure with all parameters ? Maybe I've 30 parameters to pass !  ! !
T_NombreTableAdapter.SP_Añadir(NombreTxt.Text, ApellidoTxt.Text,   [........  to 30 ! ! ! ! ])


Thanks again for your help..I appreciate soooo much !!!!!!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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