Click to See Complete Forum and Search --> : Arhhgg!
spuppett
October 28th, 2004, 02:25 PM
I am new ADO. I've been using DAO exclusivly for a while, and am tring to migrate to ADO. I've thus far managed to set up the connection string(a daunting task). Now I would like to be able to query my database. I've looked and looked, but there is nothing I've been able to find that does it at all. In DAO, all I did was .RecordSource = "SQL..." .Refresh, and voila, a new .recordset.
Is there something as easy(or easier) for ADO?
Here's what I've got so far...
Adodc1.ConnectionString = "Provider=VFPOLEDB.1;" & _
"Data Source=N:\personal\awilliams\basic;Password="";Collating Sequence=MACHINE"
Adodc1.RecordSource = "basic"
Thank you.
Got it taken care of. I was missing 2 "" in the connection string.
P.S. I'm using VB and FOXPro
spuppett
October 28th, 2004, 03:21 PM
Moving on.
I kind of got something to work
Dim rs As ADODB.Recordset
Dim con As ADODB.Connection
Set rs = New ADODB.Recordset
Set con = New ADODB.Connection
con.ConnectionString = "Provider=VFPOLEDB.1;" & _
"Data Source=N:\personal\awilliams\basic;Password="";Collating Sequence=MACHINE"
con.Open
Set rs = con.Execute("SELECT * FROM basic ORDER BY ssn")
Do While Not rs.EOF
Debug.Print Trim(rs.Fields("first").Value)
'Debug.Print vbCrLf
rs.MoveNext
Loop
it craps out on the connectionString, but if I step over it and continue excecution, it finishes beautifly.
Any thought?
the connection string is what gets built by VB if I click on the connectionstring property for a ADODB object. I'm sure its right, but its wrong?
I was missing some quotation marks. I got it figured out though.
I don't know that I like this any better than DAO as of right now. If someone could tell me why I should, I would be greatful.
spuppett
October 28th, 2004, 04:07 PM
New troubles.
I cannot move backwards through my rs. Moving forward is no problem at all.
I tried to set the cursorType to 2(adOpenDyamic), but then when I actually set rs, it changes back to 0(adForwardOnly). I can't set cursorType after the rs is set.
Any thoughts.
-----------------------------------------------------------
figured it out. You can't implicitly create/open an rs and change cursor/locktypes.
-----------------------------------------------------------
If anyone can tell me why to use ADO instead of DAO, feel free, cause I don't see any reason as of right now.
hspc
October 29th, 2004, 02:20 AM
If anyone can tell me why to use ADO instead of DAO, feel free, cause I don't see any reason as of right now.
check :
ADO vs DAO vs Others? (http://www.codeguru.com/forum/showthread.php?t=235408&highlight=ado+dao)
and :
http://www.codeguru.com/forum/showthread.php?s=&threadid=248230
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.