-
Jan 24th, 2006, 12:02 PM
#41
Re: ADO Beginners Tutorial
You need to add the part in bold (where *** is your password):
VB Code:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= c:\my documents\DB1.mdb[b];User Id=admin;Password=***;[/b]"
-
Jan 25th, 2006, 05:47 AM
#42
Member
Re: ADO Beginners Tutorial
Thanks for the reply Si, I think I may have the Database incorrectly saved.
When I try to open it in code using the connection string I get the error message
"Cannot start your application. The workgroup information file is missing or opened exculsively by another user."
Any ideas?
-
Jan 25th, 2006, 05:58 AM
#43
Re: ADO Beginners Tutorial
Is the database open in another program? (if so, close it)
If not, it is possible that the connection string is still not right, see the link in my signature for examples of variations.
-
Jan 25th, 2006, 07:29 AM
#44
Member
-
Jan 25th, 2006, 07:40 AM
#45
Re: ADO Beginners Tutorial
The database is connected, otherwise you would have got an error at the "cnn1.open" line.
The error about not being able to find "First Name" is due to that not being a field in your "Mailing List" table. Check you have the spelling correct, and that you are using the right table.
-
Feb 25th, 2006, 03:06 AM
#46
Lively Member
Re: ADO Beginners Tutorial
Like in adodc there is adodc1.refresh so whats in ado connection is it cn.refresh or any other thing ?
-
Feb 25th, 2006, 03:34 AM
#47
Hyperactive Member
Re: Database Password Protection
My database is password protected.
Where in the connection string is the password inserted please?
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "/db1.mdb ;Persist Security Info=False;Jet OLEDBatabase Password=mikee_phil
-
Feb 25th, 2006, 05:35 AM
#48
Lively Member
Re: ADO Beginners Tutorial
Originally Posted by mendhak
Store the values into variables.
Then, use the connection object's EXECUTE method to execute the SQL INSERT query.
Can you please give an example of how to do this is i have been stuck on this for days.
-
Feb 25th, 2006, 09:55 AM
#49
Re: ADO Beginners Tutorial
See How can I add a record to a database? from the DB FAQ.
Originally Posted by Muhammad Haris
Like in adodc there is adodc1.refresh so whats in ado connection is it cn.refresh or any other thing ?
You don't need to do anything other than open the recordset. You then simply use any code you want to work with/show the data.
-
Feb 26th, 2006, 08:49 AM
#50
Junior Member
Re: ADO Beginners Tutorial
I have used this tutorial and it has been great, but i was wondering how to Query another table
would i need to open a totaly new connection and have second connection to the database running ?
I have table1 which has a primary key ID this holds basilcy name and e-mail address i want to use this ID to link other tables.
I have table2 which i want to reference by the ID of the first table
So using this tutoral i have got the part working to display the info from table 1
now i also want to have it look up the ID in table2 and display any infomation it finds
I would assume the query could be somthing like
Select * from table2 where ID = "ID im looking up"
then basicly out put the data the same way as in table 1?
Im new at this sooo simple is good
Any help on this would be apreciated
-
Feb 26th, 2006, 05:32 PM
#51
Re: ADO Beginners Tutorial
Welcome to VBForums!
You only need one connection - you can have multiple recordsets open thru it if you want.
Assuming that the data is "master-detail" (1 row in the first table relates to multiple entries in the second) then two recordsets is the way to go. Just declare another recordset object, and open it using the previous connection object.
If the data has a one-to-one relationship, you can use SQL to return both lots of data in the same recordset.
-
Feb 26th, 2006, 07:52 PM
#52
Junior Member
Re: ADO Beginners Tutorial
ok thanks i shall give it a go
-
Mar 1st, 2006, 02:21 PM
#53
Junior Member
Re: ADO Beginners Tutorial
Ok having a problem with searching, is there a like in built way to search the database, or am i going to have to dump it out to an array and loop the data to find a match ??
a code example would be helpful
-
Mar 1st, 2006, 02:56 PM
#54
Hyperactive Member
Re: ADO Beginners Tutorial
Originally Posted by AllanM
Ok having a problem with searching, is there a like in built way to search the database, or am i going to have to dump it out to an array and loop the data to find a match ??
a code example would be helpful
You can check my recent post, I asked something like that !
http://www.vbforums.com/showthread.php?t=390117
I hope this will help you !
-
Mar 6th, 2006, 06:32 AM
#55
Junior Member
Re: ADO Beginners Tutorial
yes looks pritty good, thanks for the reply
-
Mar 17th, 2006, 10:56 AM
#56
Junior Member
Re: ADO Beginners Tutorial
This part of the code, where it fills the combo box with all the record numbers
rs.MoveFirst 'moves to the first record
Do Until rs.EOF = True 'this is the Loop to add items to the combo box
combo1.AddItem rs.Fields("field1") 'this adds items from field1 into the combo box
rs.MoveNext 'moves next record
Can you do rs.move to a specific record in the record set? so if they were all indexed via a number i could just jump stright to that record or would i have to say so somthing like rs.bof and then increment a loop of rs.MoveNext how ever many times i wanted to get to the correct record
i currenly have a search which will display a record number and from this would like to be able to just called up that record for editing
-
Mar 17th, 2006, 11:19 AM
#57
Re: ADO Beginners Tutorial
You can move to a specific record using the .Move method, however this is not the recommended approach - as data taken from databases should not care about the position of records (theoretically if you return the same set of data twice it may not be in the same order).
It is better to use something unique about the record instead, and load data based on that. If you have an Autonumber or Identity field, that is the perfect candidate for this, and can be used as part of an SQL statement to load (or edit) only that particular record.
-
Mar 21st, 2006, 02:42 AM
#58
Member
Re: ADO Beginners Tutorial
hello
i need step by step instruction about connection strings for ADO..
i want to build database using vb6 and ms access..
my problem now i cant link vb6 to ms access.
-
Mar 21st, 2006, 01:02 PM
#59
Re: ADO Beginners Tutorial
The tutorial shows how to connect to an Access database, all you should need to change is the file name/location.
If you need further help, see the Connection Strings link in my signature.
-
Apr 28th, 2006, 05:48 PM
#60
Fanatic Member
Re: ADO Beginners Tutorial
I'm trying to open a database w/ a password, I can open it fine when there's no password, but what code do I use to add the password?
this is the mods I made to the code so far, but is says that "Could not find installable ISAM"
VB Code:
Set cn = New ADODB.Connection 'we've declared it as a ADODB connection lets set it.
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= c:\DB1.mdb;Jet OLEDB;Database Password=mypassword" 'this is the connection string explained in the notes section.
cn.Open
Thanx
p.s. code snippets help me, I'm a real noob, and a visual learner
also, is there a way to change the password on the .mbd file inside the program? The problem I actually have is that the messaging program I'm making uses a text file to store lots of user settings, the problem is is that an idiot in my class tries to screw it up constantly, so when I boot him off of it, he has already made a copy of the program storring the info, so he just replaces it back, and he's back on. I want a way to change the password without having to re-compile the program to change the password, to render his old copy uselesss
Last edited by ididntdoit; Apr 28th, 2006 at 05:55 PM.
-
May 1st, 2006, 05:47 PM
#61
Re: ADO Beginners Tutorial
The error (almost always) means that the connection string is not correct.
Check out the "connection strings" link in my signature, and try the variations shown there. If that doesn't help, post a new thread instead of extending this one even further.
-
May 11th, 2006, 03:59 AM
#62
Hyperactive Member
-
May 11th, 2006, 09:47 AM
#63
Re: ADO Beginners Tutorial
That same question was asked two posts earlier... read the post above yours for the answer.
(the answer is also in post 41)
As this thread is getting so many repeated questions, I am closing the thread to new replies.
If anyone wants to ask a question relating to the tutorial, the chances are that it has already been answered here, so please read the previous replies.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|