Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP connection to visual foxpro

Reply
Thread Tools

ASP connection to visual foxpro

 
 
jagvrb@aol.com
Guest
Posts: n/a
 
      10-22-2008
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.
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-22-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Visual FoxPro FPOLE.OCX Insecure Method Command Execution Au79 Computer Support 1 10-19-2007 12:29 PM
Fresh Programmers Required Visual Foxpro HR Head C Programming 2 09-05-2007 09:09 PM
ODBC - Visual FoxPro Tables Andrzej J. Turowicz Windows 64bit 3 03-03-2006 12:25 AM
Visual FoxPro OleDB Driver in ASP.NET Jan Smazinka ASP .Net 0 11-28-2003 09:29 AM
calling stored procedure from Visual FoxPro database JN ASP .Net 0 11-05-2003 03:00 PM



Advertisments