Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP Syntax to View Visual FoxPro Table
Message
From
09/08/2005 10:21:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01039429
Message ID:
01039540
Views:
18
>Does anybody know what syntax I need to use to connect to a Visual FoxPro table? I'm using ASP.

You can use VFPOLEDB. ie:
<%
cSQLSelect = "select * from employee where !isnull(birth_date) and !isnull(hire_date)"
cSQLInsert = "insert into employee " &_
    "(emp_id,First_name,last_name,hire_date)" &_
    " values ('CBASOZ','Cetin','Basoz',date())"
cSQLUpdate = "update testdata!employee " &_
   "set " &_
   "Birth_date = {^1961/01/19}, "	& _
   "Title = 'FoxyClasses Developer' " & _
   "where emp_id = 'CBASOZ'" 
cStoredProcCall = "myStoredProc('ReverseMe')"

    dbpath = Server.MapPath("data")
    set oConnection = Server.CreateObject( "adodb.connection" ) 
    with oConnection
       .ConnectionString = "Provider=VFPOLEDB;data source=" & dbpath & "\testdata.dbc"
       .Open
       .Errors.Clear	
       .Execute( "set null off" )
 '      .Execute( cSQLInsert )
 '      .Execute( cSQLUpdate )
       Set rs = .Execute( cSQLSelect )
    end with
    ' Check results
    Response.Write("<TABLE border='1'><TR><TD>Emp Id</TD>" & _
    "<TD>First Name</TD><TD>Last Name</TD><TD>Title</TD><TD>Born</TD><TD>Hired</TD></TR>" )
    while not rs.eof
            Response.Write("<TR>")
            Response.Write("<TD>" & rs.Fields("emp_id").value & "</TD>")
            Response.Write("<TD>" & rs.Fields("first_name").value & "</TD>")
            Response.Write("<TD>" & rs.Fields("last_name").value & "</TD>")
            Response.Write("<TD>" & rs.Fields("title").value & "</TD>")
            Response.Write("<TD>" & DatePart("yyyy",rs.Fields("birth_date").value) & "/" & _
              DatePart("m",rs.Fields("birth_date").value) & "/" & _
              DatePart("d",rs.Fields("birth_date").value) & "</TD>")
            Response.Write("<TD>" & rs.Fields("hire_date").value & "</TD>")
            Response.Write("</TR>")
            rs.MoveNext
    wend
    Response.Write("</TABLE><BR/>")
	
'	set rsc = oconnection.execute( cStoredProcCall )
'	response.write(rsc.fields(0).value)
	
    oConnection.Close
    set oConnection = nothing
%>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform