Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to foxpro databases use

Status
Not open for further replies.

07sprint

Programmer
Sep 18, 2003
25
0
0
US
Connection to foxpro databases use vb 6.0.

I'm getting a error message:

The connection cannot be use to perform this Operation. It is either closed or invalid in this context.

This is the code:

Dim cn As New ADODB.Connection
cn.Open "Provider=vfpoledb.1;" & _
"Data Source =D:\PerCap1\percap2.dbf;"
cn.Close

'Dim cn As Object
cn = CreateObject("ADODB.Connection")
cn.ConnectionString = "provider=vfpoledb.1;Data Source =D:\PerCap1\percap2.dbf"
cn.Open

I get to this code when the error message appears.

Set rs = cmd.Execute
 
"cn" is an object so you need

SET cn = CreateObject("ADODB.Connection")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top