Important alert: (current site time 7/16/2013 12:55:34 AM EDT)
 

winzip icon

[ ADO Primer ]

Email
Submitted on: 12/31/2003 11:31:45 PM
By: twistedthoughts 
Level: Intermediate
User Rating: By 83 Users
Compatibility: VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 125623
 
     [ADODC IS E V I L!] Have you reached a stage when you realize that the standard ADO Data Control Shipped with VB is not enough for you?? Ever Wondered How You Can Connect To A Database with code? How You Can Read, Write, Delete, Change data in Tables ? Well, Here's a small Application which uses ADO Code to manipulate data in a table. I've also included code to Enable or Disable the Command Buttons in the Window based on the context (For exampling disabling First & Previous buttons when you are in the first record...).

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/2/2004 8:12:01 AMgary

thanks for your code
i give you 3vote for me
(If this comment was disrespectful, please report it.)

 
1/14/2004 10:20:06 PMKevin Harris

Good code dude, I'm trying to learn my ADO and stuff so I appericiate it. I give it a 5.
(If this comment was disrespectful, please report it.)

 
1/15/2004 4:25:47 AMtwistedthoughts

Thank You Kevin

Enjoy Programming !!!!!

Drop me a line if u require any clarification...

(If this comment was disrespectful, please report it.)

 
1/20/2004 5:12:09 AM

Thanks for the code.
I give you a vote of 5
(If this comment was disrespectful, please report it.)

 
1/20/2004 12:31:52 PM

What if you wish to store over 255 chars in a field? Must you then save the information in a file?

(If this comment was disrespectful, please report it.)

 
1/20/2004 11:08:21 PMtwistedthoughts

Well, You can use 'Memo' Field Type to store over 255 chars. I guess the field length is only limited by the size of the Database.
(If this comment was disrespectful, please report it.)

 
1/21/2004 8:48:08 AM

Thank you, I worked with a friend last night and we figured it out. I program alot in VB but never really use DB's. Thank's

(If this comment was disrespectful, please report it.)

 
1/23/2004 10:57:37 PMtwistedthoughts

:)

Anytime...

(If this comment was disrespectful, please report it.)

 
2/20/2004 3:45:27 AM

Thank's for the code,
I don't now how to tell
couse I still learn VB
Thank's
(If this comment was disrespectful, please report it.)

 
2/22/2004 12:24:12 AM

Your code works well. I have been accessing databases with DAO and was looking for an easy method for using DAO without a data control on a form. This is what I was looking for. It seems that other than setting up the database object(DAO) vs. the connection object (ADO), and a slight difference in setting up the recordset, I should be able to change my existing code more easily than expected to ADO.

Thanks again. 5 stars.
(If this comment was disrespectful, please report it.)

 
2/22/2004 12:25:33 AM

Typo in my post.. I meant to say that I was "looking for an easy method of using ADO ..." sorry for the confusion
(If this comment was disrespectful, please report it.)

 
2/22/2004 1:46:18 AMtwistedthoughts

Hi There!
Thanks for the comments & vote.

Well, ADO is much simpler to DAO in my opinion. If you have experience in DAO, it won't be a problem at all to migrate to ADO. You can drop me a line anytime for clarifications...
Sorry, I have made the code a bit harder to read (because of all those control dimming codes) which otherwise would have been much simpler...


(If this comment was disrespectful, please report it.)

 
3/31/2004 1:46:28 AMRaja Iskandar Shah

I am confused. How is it different from the standard VB6 data form wizard using ado code ? A good reference for ado is http://www.winnetmag.com/Articles/ArticleID/16272/pg/1/1.html . As well as http://www.devguru.com/Technologies/ado/quickref/ado_index.html . Hope that helps everyone.
(If this comment was disrespectful, please report it.)

 
4/17/2004 11:16:39 AM

Good Programme,
I have used your code in my simple applicatio.
Can you send me how to search a record with this application in opened new form.
if you have solution please send me email jsprajapati@yahoo.com
(If this comment was disrespectful, please report it.)

 
4/19/2004 5:01:18 PM

Awesome code. Nice to find a tutorial without all the bells and whistles. I was needing some tutorial with just the meat on the bones without having to sort thru all the cutsey extra clutter that normally comes with tutorials.
(If this comment was disrespectful, please report it.)

 
4/27/2004 3:50:25 PM

dddddd
(If this comment was disrespectful, please report it.)

 
5/4/2004 1:17:43 AMAbdulkader Bin Walid

I would like to thank you for posting this wonderful peace of code. keep up the good work.
(If this comment was disrespectful, please report it.)

 
5/10/2004 1:21:06 AMtwistedthoughts

thank you for all the comments Gentlemen!

(If this comment was disrespectful, please report it.)

 
5/10/2004 1:35:38 AMtwistedthoughts

Dear Raja Iskander Shah

Well, I wrote this tutorial as a reference for beginners/intermediate users and It's not a complete ADO reference manual. It took me a lot of time to master ADO programming, so I thought I'll share what I know and hence the posting...

I've checked both the links you provided and both of them are superb. thankx for sharing...
(If this comment was disrespectful, please report it.)

 
5/26/2004 9:18:01 PM

hey nice sode. anyway how can i connect a database over a network? lets say i have 4 PCs, one will be serving the MDB File the 3 will be front ends..having trouble working at that stage..pls i need advise though..
(If this comment was disrespectful, please report it.)

 
5/26/2004 9:23:55 PM

i meant nice code...
(If this comment was disrespectful, please report it.)

 
7/3/2004 6:51:25 PM

Thanks, nice code. :)
(If this comment was disrespectful, please report it.)

 
7/6/2004 8:00:23 AM

How can i delete all information in Db connected with ADODC while loading the program again
(If this comment was disrespectful, please report it.)

 
7/20/2004 2:43:37 PMSteadler

ADO RULEZ
(If this comment was disrespectful, please report it.)

 
8/10/2004 4:36:48 AM

Thanks a lot of sharing this coding for us!!!!!
(If this comment was disrespectful, please report it.)

 
10/28/2004 7:35:37 AMmanoj

ok
(If this comment was disrespectful, please report it.)

 
11/4/2004 1:04:27 PMEric Harris

I am getting a compile error:
"Can't find project or library"

on the line that says:
rsUsers.CursorLocation = adUseClient

I really want to learn ADO, so any help on getting this to work would be greatly appreciated.
(If this comment was disrespectful, please report it.)

 
12/30/2004 5:32:59 PM

I know how to use ADO with Access or any SQL applications, but I want to know how to use ADO with Excel as backend...
Thanks
(If this comment was disrespectful, please report it.)

 
12/30/2004 5:34:30 PM

I know how to use ADO With Access or any other SQL Applications but don't know how to use it Excel as backend...Could you please assit me in this.
Thanks
(If this comment was disrespectful, please report it.)

 
1/3/2005 11:00:28 AM

know how to use ADO with Access or
any SQL applications, but I want to
know how to use ADO with Excel as
backend...
Thanks

(If this comment was disrespectful, please report it.)

 
1/3/2005 11:09:48 PMtwistedthoughts

Change the connection string to reflect the following...

oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=c:\somepath\mySpreadsheet.xls;" & _
"DefaultDir=c:\somepath"

Visit the following URL for more info... I've never tried excel with ado yet so can't really comment on the functionality though. Hope this info will get you going. Let me know if u need any assistance... will b glad to help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/o dbcjetmicrosoft_excel_driver_programming_considerations.asp

(If this comment was disrespectful, please report it.)

 
1/16/2005 10:50:03 AM.netLimit Productions

Neat code, just what i was looking for!
(If this comment was disrespectful, please report it.)

 
1/23/2005 10:21:39 PM

its amazing, i got the right thing
thanx a lot for this
(If this comment was disrespectful, please report it.)

 
1/28/2005 11:47:21 PM

Thanks a lot for this
(If this comment was disrespectful, please report it.)

 
3/7/2005 8:26:02 PM

Excellent code, nice and easy to work with. Many Thanks. 1 question tho… Im trying to create a button to perform the task of saving the “Users” table from MyDB.mdb as a .XML file. Any suggestions or pointers will be greatly appreciated.
(If this comment was disrespectful, please report it.)

 
3/13/2005 7:57:03 PMGuayo

nice work. do you mind showing me how to connect to a SQL Server database?
(If this comment was disrespectful, please report it.)

 
3/14/2005 10:42:59 PMtwistedthoughts

Thankx for the comments & votes.

1. XML - I haven't tried it yet, so I'm afraid I cannot help you in this.
2. SQL Server Connection String: Guayo, replace the connection string with the following ...

oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"


(If this comment was disrespectful, please report it.)

 
4/17/2005 7:47:51 AM

thank you
(If this comment was disrespectful, please report it.)

 
4/17/2005 3:38:47 PMJames

good job, give you 2 vote
(If this comment was disrespectful, please report it.)

 
4/29/2005 7:45:31 AM

Good.
(If this comment was disrespectful, please report it.)

 
5/2/2005 9:28:44 PM

need a little bit of assistance when a record is edited!!

The SQL UPDATE statement is only for a specific is only for the username, what do i have to do so that when the password is altered i have an option to save and update the record.

Many thanks for ur time.

(If this comment was disrespectful, please report it.)

 
5/2/2005 9:38:30 PM

just realised it only works the 1st time u alter a record. When trying to edit a record again the save and cancel buttons are not enabled.

Thanks for ur help in advanced :-)
(If this comment was disrespectful, please report it.)

 
5/7/2005 5:06:54 AM

thanks a lot! i've been trying to figure this out on my own for months! thanks a lot!
(If this comment was disrespectful, please report it.)

 
5/11/2005 8:58:23 PMErcoupeBaby

Nice code dude, thanks for the work I've been looking for a good clean ADO starter..I gave you 5!
(If this comment was disrespectful, please report it.)

 
5/15/2005 12:00:45 AMtwistedthoughts

Thanx Guys for the comments & Votes!!!! Appreciate It.

Quote
--------------------------------------
need a little bit of assistance when a
record is edited!!

The SQL UPDATE
statement is only for a specific is
only for the username, what do i have
to do so that when the password is
altered i have an option to save and
update the record.

Many thanks for
ur time.

---------------------------------------
UnQuote

I'm so sorry but I don't think I understood u properly. Send and email to russel.ak@rediffmail.com and I'll see if we can clear your doubts.
Cheers

(If this comment was disrespectful, please report it.)

 
5/17/2005 4:16:26 PM

Thanks for
your help
(If this comment was disrespectful, please report it.)

 
5/25/2005 10:51:54 AMMichael Heath

Thanks for the code. I've wanted to credit you as a reference in one of my projects - I'd rather not use the name "twistedthoughts". If you want the credit, please e-mail me your name. primalbreathren@yahoo.com.

Thanks!
(If this comment was disrespectful, please report it.)

 
7/5/2005 11:25:28 PM

not bad

(If this comment was disrespectful, please report it.)

 
8/4/2005 6:03:31 AMbayu

i have been search this login form with database, thanks
(If this comment was disrespectful, please report it.)

 
10/25/2005 12:18:00 AMsugar

Good software
(If this comment was disrespectful, please report it.)

 
4/18/2006 5:20:55 AMpapa_nemo

tq so much k
(If this comment was disrespectful, please report it.)

 
7/4/2006 12:56:44 AMEric

Well, I am a newbie in VB6 but I like this code a lots....Good Work
(If this comment was disrespectful, please report it.)

 
7/10/2006 3:20:06 AMRinco

Really good, Thank U
(If this comment was disrespectful, please report it.)

 
7/30/2006 12:13:36 AMVeno Fern

so easy so fast, I appreciate your approach. thank you.
(If this comment was disrespectful, please report it.)

 
8/5/2006 4:10:05 AMtwistedthoughts

Thanx guys/gurls 4 all the comments & support. I'm planning to relase an MDI version of the same soon.

(If this comment was disrespectful, please report it.)

 
9/26/2006 1:47:54 PMrajwant

most helpfull
(If this comment was disrespectful, please report it.)

 
10/1/2006 6:25:06 AM

Your code works well.Thanks
(If this comment was disrespectful, please report it.)

 
12/5/2006 12:10:42 AMdedy

good
(If this comment was disrespectful, please report it.)

 
12/11/2006 6:21:41 AMNkechi Ifesie

Your program is a lifeSaver. But i need you to clarify o one part, what exactly does & "" here txtUserName.Text = !UserName & "" do? Thank you. AM sorry about the mistake in placing the mail in bad submission. Awaiting your quick response.
(If this comment was disrespectful, please report it.)

 
12/11/2006 6:44:46 AMNkechi Ifesie

Dont mind my one one question. I am going step by step in your program and using it to develope mine. The MDirty how does it really function?
(If this comment was disrespectful, please report it.)

 
3/5/2007 9:27:06 AMKetan_pote

I am developing a inventory software
all are completed but i one problem is born that i using data1 control ado
so when i add a new record then the record is added but it is added to last of the database , so i want to add record, any where i want so please help
(If this comment was disrespectful, please report it.)

 
3/7/2007 8:24:46 AMJoseph

this is good.
(If this comment was disrespectful, please report it.)

 
5/23/2007 4:11:46 PMjude

Who are you!!!!!!????
thanks....a agree with you....ADODC makes me comfortable but it is not enough...thanks a lot...
i've always wanted to switch my codes....ADODC is good but connecting with codes is waht i like to learn...thank ypu...happy coding
(If this comment was disrespectful, please report it.)

 
10/16/2007 10:01:23 AMBatista

Great!

I have a suggestion, you may insert a blank space after the textboxes, that way at least the minimum length of the user or pass field is 1 not 0.


Sorry for the bad english.
(If this comment was disrespectful, please report it.)

 
10/24/2007 2:04:43 PMPedro

Thank for you code.
(If this comment was disrespectful, please report it.)

 
3/19/2008 9:57:11 PMMaddKat

nice code, iv been doing ado with asp for along time so this is basically the same, but my question is about the code that has
rsUsers!UserName now this pass's vb's syntax check but iv never seen code used like this... i also dont see rsUsers!UserName dim as a var, i see rsUsers but not the rest, can you e-mail and explain whats going on their jon@gomadd.net
(If this comment was disrespectful, please report it.)

 
3/30/2008 2:19:28 PMpenti

thanks for your code..very useful..
(If this comment was disrespectful, please report it.)

 
4/4/2008 4:59:23 AMJoko

Thanks for your code...
(If this comment was disrespectful, please report it.)

 
1/29/2009 6:06:13 AMDavid

Thx for your respon
(If this comment was disrespectful, please report it.)

 
8/28/2009 1:31:32 AMmcrm

Your code is good.....but hard to read
Could you pls.give me a more simplied code than this one...coz, i am having a hard time to understand it...i really need it...thanks.
(If this comment was disrespectful, please report it.)

 
9/23/2009 1:05:26 PMPablo

It's a good work, I have to prove it more
(If this comment was disrespectful, please report it.)

 
1/9/2010 8:21:37 AMArjohn

Good work buddy! I rate you 9 out of 10
(If this comment was disrespectful, please report it.)

 
6/8/2010 5:24:46 PMashour

Thank you
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.