Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB DataGrid Update
Message
De
29/07/1999 10:32:43
 
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00246559
Message ID:
00247670
Vues:
21
Thanks for your help. I was using SQL server on the network. The following is my code to access the SQL server for the data and then display the data in the data grid. After the user make any changes and click "update", the data will be saved in the SQL server. Do you see any problems in the code?

Dim db As Connection
Dim WithEvents rsgrid As ADODB.Recordset

Private Sub RSetInit(sSQL As String, db As Connection, rs As Recordset)
'Get the record set

db.Open "dsn=csudb"
rs.CursorLocation = adUseClient
rs.Open sSQL, db, adOpenStatic, adLockOptimistic

Private Sub txtFamGet(sID As String)
'Get a record for a given ID.

Dim sSQL As String

sSQL = "SELECT f.idnum, f.fidnum, i.fulname, f.related FROM donFam f, CSUid i WHERE f.idnum = '" & sID & "' And i.idnum = f.fidnum"
Set db = New ADODB.Connection
Set rsgrid = New ADODB.Recordset
RSetInit sSQL, db, rsgrid
Set grdFam.DataSource = rsgrid
'Make some changes
'Save changes
If mbEditFlag Or mbAddNewFlag Then
rsgrid.UpdateBatch adAffectAll
End If
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform