|
-
Jun 5th, 2007, 09:18 AM
#2
Re: ADODB error (newbie)
Either you're looking at the wrong mdb file (when you're opening the connection) or the table name is spelled wrong. Or the fact that you ended the connection string prematurely may be causing a problem - it should end "... Persist Security Info=False"
One hint, so you can read your code 6 months from now. You may remember what
rs.Open "select * from IATestDetails", con, 3, 3, 1
means now (I've been using ADO since it came out, and I couldn't guess), but
rs.Open "select * from IATestDetails", con, adOpenStatic, adLockBatchOptimistic
is much easier to read. (And adCmdText is the default for a recordset open, so you don't have to specify it.) Just pick from the choices VB's Intellisense gives you as you're typing the code.
And never Dim X as New ... There's no way to recover that memory without rebooting the computer (it's called a "memory leak"). Dim X As ADODB ..., then Set X = New ADODB .... When you're done with it, Set X = Nothing, and you'll recover the memory. (Running a program that doesn't recover memory, over and over, can cause the computer to crash, even when the program is no longer running.)
Someone named Beacon wrote a very good ADO tutorial. You should copy it and print it for future reference. Also, look in C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\ for the file ADO200.CHM. It's Microsoft's help file for ADO.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
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
|