ASP connection to visual foxpro

J

jagvrb

I am trying to setup an active server page that accesses my visual
foxpro database. I have setup a system DSN named vfp_test. How do you
open a recordset in an ASP? I have tried this code: rs.Open "ICILOC",
"DSN=VFP_test" , but I get an error on that line.
 
B

Bob Barrows [MVP]

I am trying to setup an active server page that accesses my visual
foxpro database. I have setup a system DSN named vfp_test. How do you
open a recordset in an ASP? I have tried this code: rs.Open "ICILOC",
"DSN=VFP_test" , but I get an error on that line.

First, create and open a connection object:
set cn=createobject("adodb.connection")
'if vfp has an native ole db provider you should use it
'see www.connectionstrings .com
'for the sake of this example I will use your DSN
cn.open "VFP_test"

Then create a sql statement to only retrieve the fields you plan to use from
iciloc which I assume is the name of the table.
sql="select filed1,...,fieldN from iciloc"

Be explicit - don't use selstar in production code:
http://www.aspfaq.com/show.asp?id=2096

Then, to open a recordset using the default server-side, forwardonly cursor:
set rs = cn.execute(sql,,1)

The 1 means adCmdText - you should always tell ADo what the command type is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top