Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Visual Foxpro for a database on a web site?????
Message
From
31/12/2000 23:19:39
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
 
 
To
30/12/2000 10:51:51
General information
Forum:
Internet
Category:
Active Server Page
Miscellaneous
Thread ID:
00457797
Message ID:
00458268
Views:
26
Thanks for the examples, that really helps... can you answer a couple questions about it?


>I have developed an ecommerce site utilizing VF database. And I too had problems and deleting records. I use a DNSLess connection (See example below). Also see the example of adding records. I think your problem is in the recordset locktype (mine seemed to be). I was forced to use native ADO comands. such as rs.LockType = adLockoptimistic did not work where as rs.Locktype = 3 did.
>
>Example DNSles VF Datasource connection string (I put mine in the global.asa in the onApplication Start)...
>
Ok, maybe you can answer a question that no one seems to be able to answer... this GLOBAL.ASA file, is
this like and INCLUDE file that needs to be referenced and uploaded to the webserver as well or is this a local
file needed when my HTML development app (Netobject Fusion and soon DreamWeaver UltraDev)?


>Sub Application_OnStart
>set ConStr = Server.CreateObject("ADODB.Connection")
> ConStr = "DRIVER=Microsoft Visual FoxPro Driver;"
> ConStr = ConStr & "BackgroundFetch=Yes;"
> ConStr = ConStr & "Exclusive=No;"
> ConStr = ConStr & "SourceType=DBC;"
> theDatabase = server.mappath("\YourRootDirectory\data\inventory.dbc")
> ConStr = ConStr & "SourceDB="&theDataBase
> Application("connectionString") = ConStr
>end Sub
>
>Example of adding records...
>
>'First setup you connection like so if you use the application scheme
> Set dbMain = Server.CreateObject("ADODB.Connection")
> dbMain.Open Application("connectionString")
>
>'Then add your record
>
> Set rsCustomers = Server.CreateObject("ADODB.Recordset")
> CustSQL = "SELECT * FROM customers where 1 <> 1"
What is this select statement for? Does this preload the record set with ALL the records in the table?

> 'BeginTrans speeds up accesing data 17 times
> dbMain.BeginTrans
> rsCustomers.ActiveConnection = dbMain
> rsCustomers.CursorType = 1
> rsCustomers.LockType = 3
> rsCustomers.Open CustSQL
> rsCustomers.AddNew
> rsCustomers( "customerid" ) = CustID
> rsCustomers ( "fname" ) = qfname
> rsCustomers ( "lname" ) = qlname
> rsCustomers ( "address" ) = qaddress
> rsCustomers ( "city" ) = qcity
> rsCustomers ( "state" ) = qstate
> rsCustomers ( "zip" ) = qzip
> rsCustomers ( "country" ) = qcountry
> rsCustomers ( "phone" ) = qphone
> rsCustomers ( "email" ) = qemail
> rsCustomers ( "machinemake" ) = qmake
> rsCustomers ( "machinemodel" ) = qmodel
> rsCustomers ( "freedollars" ) = 0
> dbMain.CommitTrans
Hmmm, what is this for... maybe that is what I am missing in my stuff

> rsCustomers.Update
> rsCustomers.Close
>
>'By the way since VF Database does not use incremental fields I create
>'one table with one numeric field for each table.That way I can ensure
>'that my indexes are always unique NEVER use session or application variables.
>'If the server goes down they will result in duplicate index numbers
>'Here is what I do for my customer table...
>
> Set rsindex = Server.CreateObject("ADODB.Recordset")
> indexSQL = "SELECT customers FROM Set rsindex = Server.CreateObject("ADODB.Recordset")
> indexSQL = "SELECT customers FROM indexes"
Two SQLs????

> rsindex.ActiveConnection = dbMain
> rsindex.CursorType = 1
> rsindex.LockType = 3
> rsindex.Open indexSql
> CustID = trim(rsindex("customers"))
> CustID = CustID + 1
> 'Assign a new value to the customer index field
> rsindex( "customers" ) = CustID
> rsindex.Update
> rsIndex.Close"
> rsindex.ActiveConnection = dbMain
> rsindex.CursorType = 1
> rsindex.LockType = 3
> rsindex.Open indexSql
> CustID = trim(rsindex("customers"))
> CustID = CustID + 1
> 'Write a new index value to the customer field
> rsindex( "customers" ) = CustID
> rsindex.Update
> rsIndex.Close
>



Thanks Mike, any help is greatly appreciated... until this message and one other, I was giving serious
consideration to blowing out the VFP stuff in this site and converting to Access. I prefer to do my regular
DB apps with VFP and hate the thought of using Access - sort of a downgrade.

Pete
Peter Brama
West Pointe Enterprises

VFP is getting easier but STILL alot to learn!!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform