Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataview - dataset - datagrid

Status
Not open for further replies.

Reinout

IS-IT--Management
Feb 22, 2004
48
BE
Hello

I have a problem using datagrids, datasets and dataviews. I fill up a dataset from a table, use it to fill a dataview and the dataview shows in the datagrid. So far so good.

Now I'm having some issues while trying to update and insert records. I have to check certain columns because they are required fields + they can't contain identical values. This is where the problems start.

When entering values in the datagrid, I can't seem to check the values (if I enter nothing, the datagrid.item(i,j) property just shows the previous value of the field when checking) before writing them in the dataset, so I always have to restore those manually, no probs when you don't use sorting on the grid, but problems start entering when you sort the records or hide values with certain values (checkbox checked/unchecked).

Some code :
myDataset = Object.fillDS("stored_procedure", name_table)
myDataview = New DataView(myDataset.Tables(0), "checkbox1 = 1", "value to sort on", DataViewRowState.CurrentRows)
myDatagrid.DataSource = myDataview


Is there another way to hide/show records then using the dataviews?
 
I might have to add I use the SQL Helper class to update my database, using both an Update & Insert query at once (delete is not needed). I don't check whether a line is added or not, I just call both stored procedures and it decides itself what procedure is needed.
 
The problem occurs when I try to insert an incorrect record, so missing some values, or when I empty an existing record in the mode where I don't show all records.

So correct inserts and correct updates do work, I just can't find a way to control values in the datagrid / dataview before they are written to the dataset :s
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top