|
|
#1 |
|
PowerPoster
Join Date: Jan 01
Location: Pub Floor
Posts: 3,188
![]() |
G'day folks,
Just thought i'd attach my "An introduction to ADO" tutorial for anyone wanting to learn how to work with databases or wanting to learn how to use ADODB. It is for beginners so it's not too complicated hopefully it's easy enough to read and understand. It's password protected so just choose read-only when you open it. cheers beacon ![]() added by si_the_geek: Note that there are some bugs in this tutorial, you can find a corrected version of the tutorial in the thread: ADO Tutorial for Classic VB If anyone wants to ask a question relating to the tutorial, the chances are that it has already been answered in this thread (so please read the replies!), or is in the thread ADO Beginners Tutorial, Some Further Steps. If you cannot find an answer to your question, please create a new thread in the Database Development forum - several people who can help will read it. Last edited by si_the_geek; Jan 28th, 2009 at 06:11 PM. |
|
|
|
|
#2 |
|
New Member
Join Date: Apr 02
Posts: 3
![]() |
Your ADO tutorial was unbelievably helpful. Hats off to you.
One question: If my database file(DB1.mdb) is not on my harddrive and is actually on the internet, what changes do I have to make to the code in order to access it? I've tried everything and nothing worked. Thank you so much. Again, your tutorial was superb. |
|
|
|
|
#3 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
|
|
|
|
#4 |
|
PowerPoster
Join Date: Jan 01
Location: Pub Floor
Posts: 3,188
![]() |
Yeah but they arent as helpful as my tutorial!
![]() Anyways instead of the pc name put in the ip address of the computer with the db in it! Later b
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
your file used password protect.
I can't read tell me password please. |
|
|
#6 | |
|
Lively Member
Join Date: Apr 02
Location: Zierikzee, The Netherlands
Posts: 98
![]() |
Quote:
![]() The WiseGuy
__________________
I stuck my head out of the window and got arrested for mooning! This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17". O/S: Windows XP Professional (dutch) Internet: Cable (1Mbit connection) |
|
|
|
|
|
#7 |
|
Stuck in the 80s
Join Date: Jul 01
Location: Michigan
Posts: 7,254
![]() |
Great tutorial Beacon! You might wanna run through it with a spell check though
Also, first you say that you're going to refer to the table as 'table1' then you say 'tbl_master' throughout the document.But well done. Very helpful
|
|
|
|
|
#8 |
|
PowerPoster
Join Date: Jan 01
Location: Pub Floor
Posts: 3,188
![]() |
hehehe
Whoops! Keeping ya on ya toes! ![]() Thanks hobo! b
|
|
|
|
|
#9 |
|
New Member
Join Date: Dec 03
Location: canada
Posts: 10
![]() |
Question
Hiya Beacon
Loved the tutorial, was a big help. Question I have tho, is I'm trying to make a table bigger than what access will allow me to create. My table on my form is 20 rows deep by 10 columns wide, and each textbox in it needs a spot in the database. You know a way around that? Thx in advance *by the way...something I added to yours on my own, (I was proud cuz I'm as newbie as newbie gets hehe), is that if you dont have a pre programmed database record when you go to start the project it'll come up with an error and shut down. So on Form_load I did this at the bottom.... If (rs.BOF = True Or rs.EOF = True) Then Call Init Else: rs.MoveFirst 'moves to the first record fillfields End If Sub Init() is where i have all my textboxes set at zero...for when a user first uses a program or is starting a new file, etc etc Opens up fine with a record in it or not. ![]() I've been teaching myself over the past 3 or 4 months with a few books and forums like this as I muddle my way thru my first project
__________________
~ Hardest working newbie on the net ~ |
|
|
|
|
#10 | |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Question
Quote:
Hmm... I don't know if Beacon still visits this place. AFAIK, Access has no such limits. Perhaps you're talking about the form you're creating in VB being limited by size? If such is the case, how about using a grid? |
|
|
|
|
|
#11 |
|
Lively Member
Join Date: Apr 02
Location: UK
Posts: 90
![]() |
ADO help can be obtained here too now:
http://www.adoanywhere.com You can get online help in the forum and download the worlds most powerful ADO Browser: Mike Collier. |
|
|
|
|
#12 |
|
New Member
Join Date: Mar 04
Posts: 7
![]() |
How can I submit to a different table or query, I used beacon's tutorial and I got the information from 2 different tables but now I need to submit to a different table.
Thank you |
|
|
|
|
#13 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Store the values into variables.
Then, use the connection object's EXECUTE method to execute the SQL INSERT query. |
|
|
|
|
#14 |
|
New Member
Join Date: Apr 04
Posts: 7
![]() |
can you also use ADO to link a database to a bar chart?
if so, what code is it/change? thanks |
|
|
|
|
#15 | |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
Otherwise, it probably works off arrays, so you should store the values from your recordset into an array and then pass the array to the chart. |
|
|
|
|
|
#16 |
|
New Member
Join Date: Apr 04
Posts: 7
![]() |
hi, thanks there,
do you have any examples, or show how this code should be written? i have never done this or MS Chart before, thank you! |
|
|
|
|
#17 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
|
|
|
|
#18 |
|
Fanatic Member
Join Date: Jul 04
Posts: 736
![]() |
Hey can anyone point me to where I can download the adodb control? It's not in my components list. I've been searching and I can't find it...
|
|
|
|
|
#19 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Project > References
|
|
|
|
|
#20 |
|
Lively Member
Join Date: Nov 04
Posts: 70
![]() |
Re: ADO Beginners Tutorial
Don't know if this thread is still in use but there it goes anyway:
I got all my data in a dataset and now I'm trying to change 'field1' in 'table1'. I know there is a command dataset.select(..filter...) isn't there anything like dataset.update or something like that? And what could I do to change a value of a row of a table? Thanks in advance. |
|
|
|
|
#21 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
Use the DataAdapter's update method to update the db with changes made in the dataset.
|
|
|
|
|
#22 |
|
Lively Member
Join Date: Nov 04
Posts: 70
![]() |
Re: ADO Beginners Tutorial
Nope, I don't think that helps in my case. My database is an xml database, so I'm using no dataadapter, just the dataset. And the thing is that the change in the data comes from the user he clicks the button that says 'erase entry' and then I want the 'erased' field to be set to true. So I need to be able to do Dataset.Table.Change(...) if it existed, and then run Dataset.WriteXml(..).
So I wanna change the dataset and then write the xml. Am I missing something I should be using like a dataadapter or something like that? Thanks |
|
|
|
|
#23 |
|
New Member
Join Date: Dec 04
Posts: 2
![]() |
Re: ADO Beginners Tutorial
what if you dont have ms access 2000. how can i save things to lables or text boxes or something?
|
|
|
|
|
#24 |
|
Frenzied Member
Join Date: Oct 02
Posts: 1,343
![]() |
Re: ADO Beginners Tutorial
This thread looks dead but I thought I'd try anyway.
I'm completely new at working with DBs. I copied the code from Beacon's tut and added the reference. Made a DB in Access 2002 One table with three fields. Stored the table in the same folder as the VB project and altered the path in the form load event. WHen I get to line: Code:
cn.Open 'Run tome error -yada yada Authentication failed' Clicking 'Help' just says 'no help on subject' Not a great start. What do I do? |
|
|
|
|
#25 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
Show all the code you've used, not just that one line.
|
|
|
|
|
#26 |
|
Frenzied Member
Join Date: Oct 02
Posts: 1,343
![]() |
Re: ADO Beginners Tutorial
It all comes strait from the tutorial.
The only line I changed was the path to db1.mdb in Form_Load. VB Code:
I've also attached the DB that I made to match the one Beacon discribes. There's no info in it, just the structure. P.S. I believe the cmdDelete_Click sub needs correcting. But I didn't get far enough to test it. It also comes strait from the tutorial. Last edited by longwolf; May 15th, 2005 at 07:59 PM. |
|
|
|
|
#27 |
|
Snarky...
Join Date: May 02
Posts: 15,241
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
It's been a while since I used Access, but the connectionstring doesn't look quite right to me.
Tg
__________________
* I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.* * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft * * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming. "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN MVP '06-'10 |
|
|
|
|
#28 |
|
ASP.NET Moderator
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
You're right.
It should be cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ App.Path & "\db1.mdb" |
|
|
|
|
#29 |
|
Frenzied Member
Join Date: Oct 02
Posts: 1,343
![]() |
Re: ADO Beginners Tutorial
That fixed it, I cut too much off when I changed the path.
Another question. Is there a a help file for ADO? If so where do I get it and how would you set it so that, when you get a error msg from a line with DB code, it will check the ADO help file? I'm one of those weird people that actually use the Help Button. |
|
|
|
|
#30 |
|
New Member
Join Date: Sep 05
Posts: 13
![]() |
Re: ADO Beginners Tutorial
On the tutorial. How to update the text on TEXT box by selecting the list on the COMBO box?
Last edited by vocalmind; Sep 11th, 2005 at 05:07 AM. |
|
|
|
|
#31 | |
|
Frenzied Member
Join Date: Oct 02
Posts: 1,343
![]() |
Re: ADO Beginners Tutorial
Quote:
Change the name of the textbox and combox in the code below so they match the tutorial code. VB Code:
Last edited by longwolf; Sep 11th, 2005 at 08:50 AM. |
|
|
|
|
|
#32 |
|
Addicted Member
Join Date: Sep 05
Posts: 194
![]() |
Re: ADO Beginners Tutorial
Thanks Beacon!
|
|
|
|
|
#33 |
|
Lively Member
Join Date: Jun 05
Posts: 124
![]() |
Re: ADO Beginners Tutorial
How do I edit it so that I can search the database for a term and it displays all the info for that term?
__________________
Userbars.co.uk |
|
|
|
|
#34 | |
|
Addicted Member
Join Date: Nov 05
Posts: 185
![]() |
Re: ADO Beginners Tutorial
Quote:
|
|
|
|
|
|
#35 |
|
Frenzied Member
Join Date: Oct 02
Posts: 1,343
![]() |
Re: ADO Beginners Tutorial
I'm sorry zach007 , it's been some time since I was on this code.
I think I started with the code from the tutorial then was making changes to it to learn. |
|
|
|
|
#36 |
|
Addicted Member
Join Date: Nov 05
Posts: 185
![]() |
Re: ADO Beginners Tutorial
Hi,
What do you mean by that? Would you please provide "update" codes for everybody to learn..???
|
|
|
|
|
#37 |
|
Super Moderator
Join Date: Jul 02
Location: Bristol, UK
Posts: 29,676
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
For "update" just use the same code as cmdAdd_Click, but without the AddNew line.
__________________
Classic VB FAQs (updated Apr 15th) ...Database Development FAQs/Tutorials (updated Mar 29th) (includes fixing common VB errors) .......... (includes fixing common DB related errors, and [Classic VB] ADO tutorial /further steps, and [VB.Net] ADO.Net Tutorial). Tutorial: How to automate Excel from VB6 (or VB5/VBA) .•. SQL 'Select' statement formatter/checker .•. Convert colour number to colour name .•. FlexGrid: fill from recordset .•. FlexGrid: AutoSize columns .•. DB Reserved Words checker Connection strings .•. MDAC/Jet/ACE downloads .•. SQL Server downloads .•. MZTools (free upgrade for the VB6/VBA Editor) |
|
|
|
|
#38 |
|
Addicted Member
Join Date: Nov 05
Posts: 185
![]() |
Re: ADO Beginners Tutorial
VB Code:
Hi, for "update" existing data....which code should I delete please..??? Thanks, Jennifer
|
|
|
|
|
#39 |
|
Super Moderator
Join Date: Jul 02
Location: Bristol, UK
Posts: 29,676
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: ADO Beginners Tutorial
Just remove:
VB Code:
__________________
Classic VB FAQs (updated Apr 15th) ...Database Development FAQs/Tutorials (updated Mar 29th) (includes fixing common VB errors) .......... (includes fixing common DB related errors, and [Classic VB] ADO tutorial /further steps, and [VB.Net] ADO.Net Tutorial). Tutorial: How to automate Excel from VB6 (or VB5/VBA) .•. SQL 'Select' statement formatter/checker .•. Convert colour number to colour name .•. FlexGrid: fill from recordset .•. FlexGrid: AutoSize columns .•. DB Reserved Words checker Connection strings .•. MDAC/Jet/ACE downloads .•. SQL Server downloads .•. MZTools (free upgrade for the VB6/VBA Editor) |
|
|
|
|
#40 |
|
Member
Join Date: Oct 02
Posts: 54
![]() |
Re: Database Password Protection
My database is password protected.
Where in the connection string is the password inserted please? |
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|