franklinan
asked on
BindingNavigator problem....
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
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
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).
ASKER
please...a sample of how to call a simple stored procedure....just returning a value....
Did you create your Dataset, DataAdapter at design time? Can you edit your DataSet with designer?
ASKER
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 !
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.
ASKER
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
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
ASKER
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 !
Please...a sample....I'm totally lost !
If you already have a Dataset, you don't need to create another one. You can add adapters, queries to existing Dataset.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can you put some code of how to access insert Stored procedure created ? I don't know how to do that...
ASKER
I can't find the stroed procedures created n the Database....Something I'm doing wrong maybe....
ASKER
One last question...Actually I have modified the add item on BindingNavigator with this :
Private Sub BindingNavigatorAddNewItem _Click(ByV al sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem .Click
T_NombreTableAdapter.SP_Ad dItem(NomT xt.Text, ApeTxt.Text)
End Sub
Other Items on BindingNavigator are original....
On SAVEITEM is this :
Private Sub T_NombreBindingNavigatorSa veItem_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T_NombreBindingNavigatorSa veItem.Cli ck
Me.Validate()
Me.T_NombreBindingSource.E ndEdit()
Me.T_NombreTableAdapter.Up date(Me.Fr ankDataSet .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 ? ?
Private Sub BindingNavigatorAddNewItem
T_NombreTableAdapter.SP_Ad
End Sub
Other Items on BindingNavigator are original....
On SAVEITEM is this :
Private Sub T_NombreBindingNavigatorSa
Me.Validate()
Me.T_NombreBindingSource.E
Me.T_NombreTableAdapter.Up
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 ? ?
Because you have to refill your tableadapter.
Me.Validate()
Me.T_NombreBindingSource.E ndEdit()
Me.T_NombreTableAdapter.Up date(Me.Fr ankDataSet .T_Nombre)
Me.T_NombreTableAdapter.Fi ll(Me.Fran kDataSet.T _Nombre)
Me.Validate()
Me.T_NombreBindingSource.E
Me.T_NombreTableAdapter.Up
Me.T_NombreTableAdapter.Fi
ASKER
um...and I have to reload all Dataset ? ? ?...Not possible to only reload the modified/added records ?
I don't know the way you fill it Initially
ASKER
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_NombreBindingNavigatorSa veItem_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T_NombreBindingNavigatorSa veItem.Cli ck
Me.Validate()
Me.T_NombreBindingSource.E ndEdit()
'
If AddRecord = True Then
T_NombreTableAdapter.SP_Añ adir(Nombr eTxt.Text, ApellidoTxt.Text)
Else
Me.T_NombreTableAdapter.Up date(Me.Fr ankDataSet .T_Nombre)
End If
Me.T_NombreTableAdapter.Fi ll(Me.Fran kDataSet.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.Fi ll(Me.Fran kDataSet.T _Nombre)
End Sub
Private Sub BindingNavigatorAddNewItem _Click(ByV al sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem .Click
AddRecord = True
NombreTxt.Text = ""
ApellidoTxt.Text = ""
End Sub
End Class
I've got this code :
Public Class Form1
Dim AddRecord As Boolean = False
Private Sub T_NombreBindingNavigatorSa
Me.Validate()
Me.T_NombreBindingSource.E
'
If AddRecord = True Then
T_NombreTableAdapter.SP_Añ
Else
Me.T_NombreTableAdapter.Up
End If
Me.T_NombreTableAdapter.Fi
AddRecord = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.T_NombreTableAdapter.Fi
End Sub
Private Sub BindingNavigatorAddNewItem
AddRecord = True
NombreTxt.Text = ""
ApellidoTxt.Text = ""
End Sub
End Class
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?
And another question. What kind of control are you binding with your data? Datagridview? Textboxes?
ASKER
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(Nombr eTxt.Text, ApellidoTxt.Text, [........ to 30 ! ! ! ! ])
Thanks again for your help..I appreciate soooo much !!!!!!
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ñ
Thanks again for your help..I appreciate soooo much !!!!!!