ASP connection to visual foxpro

Discussion in 'ASP General' started by jagvrb@aol.com, Oct 22, 2008.

  1. Guest

    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.
     
    , Oct 22, 2008
    #1
    1. Advertising

  2. 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"
     
    Bob Barrows [MVP], Oct 22, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JN
    Replies:
    0
    Views:
    3,205
  2. Jan Smazinka

    Visual FoxPro OleDB Driver in ASP.NET

    Jan Smazinka, Nov 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,016
    Jan Smazinka
    Nov 28, 2003
  3. HR Head

    Fresh Programmers Required Visual Foxpro

    HR Head, Sep 5, 2007, in forum: C Programming
    Replies:
    2
    Views:
    292
    Al Balmer
    Sep 5, 2007
  4. Ethan Furman

    dBase III files and Visual Foxpro 6 files

    Ethan Furman, Dec 8, 2008, in forum: Python
    Replies:
    4
    Views:
    885
    imageguy
    Dec 9, 2008
  5. Mariano Fernandao

    [Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor.

    Mariano Fernandao, Dec 10, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    396
    Mariano Fernandao
    Dec 10, 2003
Loading...

Share This Page