A database editor (complete original program) based on ADO + ADODC control + DataGrid control

zhaozj2021-02-16  45

Database data editing demos, in Win98 debugging, please download the learning test, program size 29k

Download address: http://www.lshdic.com/download/lshdic/vb_adoEdit.zip

Code Browse:

Dim Dataname As String

Private submmand1_click () d.dialogtitle = "Opens an Access database for editing" D.FileName = "" D.INITDIR = app.pathd.filter = "Access database file MDB suffix | * .mdb" D.ShowOpenif D.FileName = "" "THEN EXIT SUB

list1.ClearSet link1 = New ADODB.Connection 'Create an ADO Connection link1.Open "Provider = Microsoft.Jet.OLEDB.4.0; data source =" & d.FileNameSet tables = link1.OpenSchema (adSchemaColumns)' Create database records in order to obtain all the table names in the database oldtablename = "" Do While Not tables.EOFIf tables ( "table_name") <> oldtablename Thenoldtablename = tables ( "table_name"): list1.AddItem oldtablenameEnd Iftables.MoveNextLoopIf list1.ListCount = 0 Then MsgBox "open database Failure, or database does not exist, Vbcritical, "Error": exit subdataname = D.FileNameList1.enabled = true: command2.enabled = truelist1.listindex = 0: list1_clickend sub

Private sub fascist2_click () ldc.recordset.Update 'Update LDC Recording Set End Sub

PRIVATE SUB FORM_RESize () edit.width = me.scalewidth - 200edit.Height = me.scaleHeight - Edit.top - 50nd Sub

PRIVATE SUB LIST1_CLICK () 'LDC Control Connection Data Source LDC.Connectionstring = "Provider = Microsoft.jet.Oledb.4.0; Data Source =" & Dataname & "; Persist Security Info = FALSE"' LDC control uses SQL commands, Get data Source Data LDC.Recordsource = "Select * from" & list1.textldc.refresh: label1.caption = "& ldc.recordset.recordcount &" record, "& ldc.recordset.fields.count &" Category field "END SUB

转载请注明原文地址:https://www.9cbs.com/read-24546.html

New Post(0)