Best data access method for VB6
Posted on 2002-06-27
It seems like I am going around in circles. I am try to find the best way for me to access data using ADO. Some people say to directly code connections and recordsets and skip the DataEnvironment and the ADO Data Control. Some say using the ADO Data Control is quick and easy, but I seem to run into walls trying to do something with it.
I would like to have the most data access flexabilty.
That said, the main problem that I am having is linking two tables together, moving around the main table while the child table moves along with it. I also want to be able to add data. My form consists of text boxes that show the main data and two datagrids which show two child data sets. For clarity purposes, the text boxes display broker information (BrokerID, Name, Address, etc.). The first Datagrid shows notes related to the Broker. The third table shows the phone numbers the broker uses. I did this so that when a broker calls up, my program uses the caller ID info from the phone company and searches for the broker information. I have addnew enabled on the datagrids, but I keep on strugling with various errors. I am using 3 ADO Data controls (1 for the text boxes, 1 for the first datagrid and 1 for the second datagrid). I am using SQL to link the datagrid ADO datacontrols to the BrokerID text box using a WHERE clause. I keep on thinking it might be best to use a SQL join in one control and have all text boxes and grids get their data from that one control. That is where my problem arises. Would it be better to go with a DataEnvironment or with The ADO DataControl or just to create a recordset in code and have the text fields and grids datasource connected to that recordset?
This is like a maze. If you go in one direction, you spend a lot of time finding out if it was the right direction only to find out that you reached a dead end and you have to back track and do more learning.
Thanks for your time and help. I am sure many of you are very busy and I am grateful for the time that you are taking to read this and to hopefully reply.