Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie ADO quesstion

Status
Not open for further replies.

comboy

Instructor
May 23, 2003
226
Hi sorry this is more than likely a very silly question but I have to ask.

The book I have to try and teach myself a bit of VB for databases always sets the connection to the datasource via VB e.g. Dim Data1 as New ADOBC.Recordsource.
But I can just place an ADO connection onto my form and work from that.

Am I missing something is it best practice to set the connection via my code, does it make a difference or do you have to do both i.e. place the control on the form and set the connection via the code?


Thanks in advance for your replies.


Graham
 
It's down to personal preference really, I (and I think most on Tek-Tips?) tend to steer away from the ADO controls. I find it easier to simply create, manipulte and destroy connections via code and it also means you don't need an extra component on your form.

I have never really used the ADO control because (rightly or wrongly, I'm leaning to rightly as I've never needed to use them for production applications) when I was learning VB I was told that it was inflexible (compared to dynamically creating your own in the code) and therefore steered to the coding option.

The control my be easier to use if you are begininning but if you're just learning you might as well use the best tools at your disposal and I don't believe that the ADO control fits that description when using ADO.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Harley
Thanks for that I had a feeling that this was the situation.
 
Although I have had formal training in other languages, but not VB, I wanted to use the ADO data control as well. Not only does it lock your database when you have the form open, it is not very flexable as HarleyQuinn mentioned. You may want to checkout on "prebuilt" connection strings that you can message to meet your needs.
 
Thanks for that I'll have a look at the site and mark it to my favorites.


Cheers,


Graham
 
As you are still learning please search the net for BOUND vs UNBOUND controls to see reasonings behing usage of either.

My personal opinion, as many here know already, is to stay AWAY of bound controls.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Hi Frederico

Yes I'm still learning and will search as you have suggested.

Thanks,

Graham
 
Hello Comboy,
Isnt it Dim Data1 as New ADODC.Recordsource instead of Dim Data1 as New ADOBC.Recordsource

A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder
 
Thanks to all for feed back
Nissan your right I'm just beginning to study VB so am using the manual to check syntax and haven't set it to memory yet.

I have two personal projects to complete in two months time (trainng dept database and a product file database) and am just dipping my toe in the water at the moment so to sort out these little questions before hand instead of having to discover them half way through as I'm sure I'll have enough questions when I get down to the projects.


Cheers,

Graham
 
I would also look at DB design fundamentals, unless you have a solid grounding in this already.

Bob
 
Bob,

Thank you for your suggestion. I have a good understanding of MS Access and will be studying admin for MySQL and MS SQL at the same time.(p.s. sorry for the late reply have no mail access when O.O.O.)


I already have a number of questions but will try and figure them out before posting, so thanks again to everyone and I'll talk to you all again soon.


Slainte,

Graham


 
Bob thanks for the document I know what you mean and should have made my earlier reply more clear regarding my understanding of Normalization etc. I've scaned the doc quickly and have already found one or two good examples.


Slainte,


Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top