selected drop down item not updated


12-14-2009, 2:21 AM
Hi,

   I have encountered a problem in drop down in a cell.
Initially I populated the grid with data from database.
After that I select a new (different) value from the drop down in one of the cell. After that I exit the Edit mode or click on other row cell, the selected value of the cell will change back to the initial value from database.

   I am not sure which event changed my value to initial value.
The grid has set to AutoField= true and CacheAllRecords=true, sgBound. I have checked that the column is set to ReadOnly=false.
What do I need to do to solve the problem?

  Thanks.

Jerry

Re: selected drop down item not updated


12-16-2009, 11:10 PM
Jerry,

If you bind SharpGrid to recordset and want to change SharpGrid values (this will also change underlying database values), you should open recordset with parameters which allow it, for example:

Dim sSQL As String
    sSQL = "SELECT Year_, Number1, Data1 FROM Main"

    ' Create connection string
    Dim sConnection As String
    sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & _
                 App.Path & "\ZP.mdb"
 
    ' Open recordset
    Dim rs As New ADODB.Recordset
    rs.Open sSQL, sConnection, adOpenKeyset, adLockOptimistic
 
    ' Bind grid to the recordsset
    SGGrid1.DataMode = sgBound
    Set SGGrid1.DataSource = rs

If this doesn't help, can you please send a small sample and steps to reproduce the issue?

Thank you,
Andrey T.