|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello All,
I am having trouble in finding out the correct way to remove a row from a dataset. I have successfully implemented editing rows and updating rows so I assume the logic is pretty similiar but i havent had any luck. Setup -------- Data Access Layer -: I have data adapters setup correctly with stored procedures for the simple management of a table within sql server 2000. Datasets are then defined from this adapter. Business Layer -: Reference to the dataset in the DAL. Datagrids setup to display and control the data. Assumed Logic ------------------- Identify Data Key from Datagrid with Select Remove the row from the Dataset using the Data Key Call an to the the Dataset. Attemped Code --------------------- Dim row As accountsDataset.spGetAccountsRow row = AccountsDataset1.spGetAccounts.Rows(DataGrid1.Sele ctedIndex) AccountsDataset1.spGetAccounts.Rows.RemoveAt(DataG rid1.SelectedIndex) handler.UpdateAccountsDataset(AccountsDataset1) Public Sub UpdateAccountsDataset(ByVal ds As accountsDataset) Try accountsAdapter.Update(ds) ds.AcceptChanges() Catch exc As Exception Dim msg As String msg = "Error while updating Account." Throw New DALException(msg, exc, ds) End Try End Sub Comments -------------- I have used a similiar approach for the inserting and updateing of rows within the dataset. I have run SQL profiler and can confirm that the stored procedure that should be run isnt actually being called at all, so the problem is definatly within the application code. My guess is im not using the Rows.Remove syntax correctly, I have played around with other ways without much luck either. Any help would be greatly appreciated. |
|
#2
|
|||
|
|||
|
try to remove any error handling code and see if u can find any error message !!
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Removing a Row from a Dataset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|