Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB DataGrid Update
Message
 
To
29/07/1999 10:32:43
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00246559
Message ID:
00247676
Views:
18
>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

This code snippet seems OK! Does it cause you any problems?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform