Hello --
A datagrid, dgrCaseSiteInput, could contain as few rows as 1. Several of
the columns are for entry.
A cmd button successfully executes a stored procedure to update the database
based on those entries.
Problem:
I don't know how to update the table after the user changes a value in an
entry column.
I don't want to have to depend on the user clicking another record in
dgrCaseSiteInput to update the source table.
This goal is an attempt to simplify the user interface, and to allow for the
possibility that dgrCaseSiteInput might contain only 1 row.
Can someone tell me
- which Event(s) to use to trap a change, and
- what method to use to write the change to the database ...
rsCaseSiteFetch.UpdateBatch adAffectAll ?
I populate dgrCaseSiteInput using code at the bottom.
Thank you for any help.
Larry Mehl
---------------------------------------------------
Dim conn As New ADODB.Connection
Dim rsCaseSiteFetch As New ADODB.Recordset
Dim strSQLCaseSiteFetch As String
Dim strCaseID As String
Set conn = New ADODB.Connection
Set rsCaseSiteFetch = New ADODB.Recordset
conn.CursorLocation = adUseClient
conn.Open "PROVIDER=MSDASQL;dsn=Provisioning;uid=;pwd=;"
strCaseID = frmMain.txtCaseID.Text
strSQLCaseSiteFetch = _
"SELECT CaseID_s, SiteID_s, HeadEndCount_s, STXInstalledYN_s, " & _
"SiteIDParentSvr_s, SiteIDParentSTX_s, HubCount_s, " & _
"HHPassedPerNode_s, " & _
"SubsDigCount_s , Nodes_Site_s, " & _
"SubsDigCountMfr_s, " & _
"PSUAgg_Svr_s, PSUAgg_STX_s " & _
"FROM CaseSite " & _
"WHERE CaseID_s = '" & strCaseID & "'"
rsCaseSiteFetch.Open _
strSQLCaseSiteFetch, _
conn, adOpenStatic, adLockOptimistic
Set dgrCaseSiteInput.DataSource = rsCaseSiteFetch
Mark J. McGinty - 12 Aug 2005 02:09 GMT
> Hello --
>
[quoted text clipped - 8 lines]
> I don't know how to update the table after the user changes a value in an
> entry column.
To cause the data source to be updated, set the grid's bookmark property to
itself. (That makes it think the position moved, without actually changing
it, and thus it performs record-field exchange.)
As for the best event, that will depend on your needs and preferences. I
wrote a little tool for examining the grid's events, you can find it on
CodeGuru at the link below.
Note that you'll want to find out which events setting the bookmark, to make
sure you don't cause an event storm.
http://www.codeguru.com/vb/gen/vb_database/datagrid/article.php/c7585/
-Mark
> I don't want to have to depend on the user clicking another record in
> dgrCaseSiteInput to update the source table.
[quoted text clipped - 43 lines]
>
> Set dgrCaseSiteInput.DataSource = rsCaseSiteFetch
L Mehl - 29 Aug 2005 02:09 GMT
Mark --
Thanks for the information and for the tool.
Larry
> > Hello --
> >
[quoted text clipped - 71 lines]
> >
> > Set dgrCaseSiteInput.DataSource = rsCaseSiteFetch