What is the best way to implement a simple database select / update program in vb6?

ok here is rhubarb - I'm working on an application written in VB6 (in which I have less than 1 month of experience), and the essence of the application is a simple selection / updating of the database for the application.

Basically, all he does is search for employees (select records from the database) and edit their data (and update the database).

Well, the way it is done in the code base that I inherited is through the unholy number of unholy big strings of SQL queries. Here is an example of a not-really-done-but-changed-protect-innocent example of what I'm talking about:

'Post Transaction to Database
If actionToDo = "Change" Then
    Set coffeeTableRS = jawsTheSQL.Execute("Update coffeeTable set Name = '" & txtName.text & "', OriginalName = '" & MOriginalName & "', Prefix = '" & txtPrefix.text & "', FName = '" & txtFName.text & "', MName = '" & txtMName.text & "', LName = '" & txtLName.text & "', Suffix = '" & txtSuffix.text & "', Relationship = '" & txtRelationship.text & "', " & _
      "Addr1 = '" & txtAddr1.text & "', Addr2 = '" & txtAddr2.text & "', StreetNumber = '" & txtStreetNumber.text & "', StreetName = '" & txtStreetName.text & "', City = '" & cboCity.text & "', State = '" & ChkNull(cboState.text) & "', ZipCode = '" & ChkNull(txtZipCode.text) & "', ZipCode2 = '" & ChkNull(txtZipCode2.text) & "', " & _
      "Birthdate = " & MBirthdate & ", SSN = '" & Trim(txtSSN1.text & txtSSN2.text & txtSSN3.text) & "', OccuCode = '" & currentOccupationCode & "', OccuValue = " & currentOccupationValue & ", ChangeDate = '" & Format(MDate, "yyyy/mm/dd hh:mm:ss") & "', Active = '" & IIf(chkActive.Value = vbChecked, "", "I") & "'" & _          
      " where IDnumber = '" & txtIDNumber.text & "'")   

And there is one of them for each action that we can take (add, edit, delete, etc.)

, , , 15 . , , , "", .

, : " GOT, // ".

VB6, / (.. DataGrid " , , " ), ( ), ( " foo 'foo')?

VB6 - ? #?

:

  • .exe
+3
7

; , ... , ADO, .

, , , . ( - ), . .

: http://www.devguru.com/features/tutorials/DisconnectedRecordsets/tutDisconnRS.asp

: , datagrid, , , - :)

+3

, 2 .

  • , . , . .

  • , , ( VB6).

, , , , .

+2

MS Access , .

+1

, ? , , . , . . "" .

0

, , , :

1) , . 1b) .

2) () .

3) Updates, , , /. /: (), (), () ( (x)). : {form} _DBAccess. SQL, - .

4) SQL. (QueryDef Access DB) SQL. vb6, .

0

, MVC, : .

Employee, , update, insert delete (- Entity in Hibernate/JPA). 2 GUI / ( ). (, , ,...) Employee , . , , .

, , , . GUI SQL , , - .

, .

0

Jet MDB ADO. , . SQL , SQL- ( ).

, Access, , , .

MVC , , . , Friend. - , , , , -, . .

It can also work well where there is no single user interface, that is, possibly the web user interface, the user interface of the alternative service delivery (IVR, public web applications, etc.). I have an application where I would like to take the MVC approach right now for this reason: a GUI program that can now also run in batch or command line mode.

0
source

Source: https://habr.com/ru/post/1709877/


All Articles