ok here's the rhubarb - I am focusing on a credit card applicatoin that's been designed in VB6 (in which i've under 1 month's experience), and also the gist from the application is it is a simple database choose/update kind of application.
Essentially all it will is that you could look for employees (choosing the record in the database), and edit their data (increase the database).
Well, the way in which this really is completed in the codebase I inherited is thru an ungodly quantity of ungodly large SQL query strings. Here is a not-really-made-up-but-transformed-to-safeguard-the-innocent illustration of what I am speaking 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's one of these simple for every action that people may take (add, edit, remove, etc.)
So quite simply, after i was requested to include an easy checkbox control towards the primary form that handles all this, I needed to add it within 15 different places. I needed to combine it with each one of these queries to make certain it had been being retrieved on record retrieval and hang on record set, in addition to setting the flag to check the information to "true" once the checkbox status did not match the record's status.
So I am searching whatsoever of the thinking "there's GOT to become a better/simpler/more maintainable method of doing this."
I understand practically nothing about VB6, but it is possible to way to create a simple choose/update database application having a nice searching GUI (i.e. we can not just hands the customer an editable DataGrid and say "here you decide to go, it's all you needInch) in which the controls are automagically certain to the database (I am speculating via fields of the identical title), and also the update can be treated easily too (becasue it is essentially just "populate control title foo with worth of database area named 'foo')?
What's the VB6 best practice method of doing something similar to this? Could it be considerably easier completed in a language like C#?
Thanks ahead of time
Edit: up-to-date specifications according to solutions given
- should be a stand alone .exe
To tell the truth you must do 2 things.
Inform individuals the have possession this application is totally unmaintainable. Make any changes needed as carefully but as expediently as possible. Don't attempt to refactor it to some better approach.
Inform individuals which have possession that they must commision a re-write (by which situation you need to escape from VB6).
If these actions aren't taken by management continue doing your very best using the current application but don't refactor, rather improve your CV, you realize the relaxation.
I'd proceed to a more recent technology stack however if this isn't possible... because it appears like you are already using ADO, you would use disconnected recordsets.
Generally what for you to do is open the recordset having a connection, set the recordsets link with nothing. Edit the recordset (it may hold off for just about any period of time) then customize the connection and hang the recordsets link with it. Then you definitely Update the batch.
This is an excellent beginning point: http://www.devguru.com/features/tutorials/DisconnectedRecordsets/tutDisconnRS.asp
Edit: I am confident you are able to bind that recordset to some datagrid, however it has been some time :)