Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Martina Jindrová
  Where is Martina Jindrová?
 Trutnov
 Czech Republic
 Martina Jindrová
 To: ian pano
  Where is ian pano?
 Metro Manila
 Philippines
 ian pano
 Tags
Subject: RE: ADODB - dbc
Thread ID: 112608 Message ID: 112629 # Views: 4 # Ratings: 0
Version: Visual FoxPro 8 Category: ODBC, ADO and OLEDB
Date: Friday, November 10, 2006 9:31:35 AM         
   


Hi Christian,

try change connectstring to:
oCN.ConnectionString = ;
"SourceType=DBC;SourceDB=C:\data1.DBC;Driver={Microsoft Visual FoxPro Driver};"

Because if you want connect to DBC (vfp database container) you set set SourceType to DBC.

MartiJ

> hello experts,
>
> how do i open a dbf in a database using ADO?
> i have tried simon arnold's sample using .mdb. it works just fine. here's the code:
>
>
>
> loCN = CREATEOBJECT([ADODB.Connection])
> loRS = CREATEOBJECT([ADODB.RecordSet])
> 
> loCN.ConnectionString =;
>  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\Test.mdb"
> 
> loCN.Open()
> 
> IF loCN.State = 1	&& If Connection is fine, create RecordSet
> 	loRS.ActiveConnection = loCN
> 	loRS.CursorType = 1 &&adOpenKeySet				
> 	loRS.LockType   = 3 &&adLockOptimistic	
> 	loRS.Open("Select * From Customers")
> 
> 	?loRS.RecordCount	&& Display Number of Records
> 	loRS.MoveFirst		&& Start At the Top of the File
> ENDIF
> 
> ** I have also tried changing the connection string 
> ** to connect to mySQL && database. also worked fine..
> ** but when i tried to connect to a dbc using && the code below,
> ** i get the error :
> 
> ** OLE IDispatch exception code from 0 from Microsoft
> ** OLE DB Provider for ODBC Drivers: ODBC driver does not support
> ** the requested properties....
> 
> 
> &&this is the code that generates the error
> 
> oCN = CREATEOBJECT([AdoDB.Connection])
> oRS = CREATEOBJECT([AdoDB.RecordSet])
> 
> oCN.ConnectionString = ;
> "SourceType=DBF;SourceDB=C:\data1.DBC;Driver={Microsoft Visual FoxPro Driver};"
> 
> oCN.open()
> 
> IF oCN.State = 1 THEN
> 
> 	oRS.ActiveConnection = oCN
> 	oRS.CursorType = 1 &&adOpenKeySet				
> 	oRS.LockType   = 3 &&adLockOptimistic	
> 	oRS.Open("select * from test") && <<--- debugger says this line causes the error.
> 	
> 	DO WHILE NOT oRS.EOF
> 		FOR lnI = 1 TO oRs.Fields.Count
> 			IF lnI = 1
> 				? oRS.Fields(lnI-1).Value
> 			ELSE
> 				?oRS.Fields(lnI-1).Value	
> 			ENDIF
> 		ENDFOR
> 		oRS.MoveNext()		
> 	ENDDO 
> 
> ENDIF
> 

>
> TIA,
>
> ian pano




JID: gorila@dione.zcu.cz

ENTIRE THREAD

ADODB - dbc Posted by Christian Pano @ 11/10/2006 5:01:47 AM
RE: ADODB - dbc Posted by Martin Jindra @ 11/10/2006 9:31:35 AM
RE: ADODB - dbc Posted by Christian Pano @ 11/11/2006 5:27:30 AM
RE: ADODB - dbc Posted by Martin Jindra @ 11/13/2006 10:32:57 AM
RE: ADODB - dbc Posted by Ken Murphy @ 11/10/2006 11:53:49 AM
RE: ADODB - dbc Posted by Christian Pano @ 11/11/2006 5:43:19 AM
RE: ADODB - dbc Posted by Ken Murphy @ 11/11/2006 3:52:27 PM
RE: ADODB - dbc Posted by Christian Pano @ 11/13/2006 5:03:32 AM
RE: ADODB - dbc Posted by Ken Murphy @ 11/13/2006 6:10:31 AM
RE: ADODB - dbc Posted by Michael Kopljan @ 11/11/2006 10:20:06 AM