Just thought that the techniques shown below might be of interest to some folk somewhere. It is a copy of a posting in a dBase newsgroup.

The bottom bit (in red) is the original posting - the top (in blue) is my reply





Subject: Re: ASP and dBASE

Hi Michael

 On my Laptop running Windows 2000 Pro, I created the following two files

*******************************
** An ASP file               **
*******************************

Dim Conn
MySQL = "SELECT * FROM visitors'"
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "FILEDSN=f:\seeif\TEMPMOD1\visitors"

Dim oRs
Set oRS = Con.Execute( MySQL )
nRecordCount = 0
Do While Not oRs.EOF
   Response.Write (oRS( "title" ) & " " & oRS( "forenames" ) & " " & oRS(
"surname" ) & "
") nRecordCount = nRecordCount + 1 oRs.MoveNext Loop Response.Write (nRecordCount) ******************************* ** A DSN file ** ******************************* [ODBC] DRIVER=Microsoft dBase Driver (*.dbf) UID=admin UserCommitSync=Yes Threads=3 Statistics=0 SafeTransactions=0 PageTimeout=5 MaxScanRows=8 MaxBufferSize=2048 FIL=dBase 5.0 DriverId=533 Deleted=1 DefaultDir=f:\seeif\data CollatingSequence=ASCII ********************************** ********************************** And it works Whooppee - thank you for waking me up BTW The DSN file was created directly with an Editor - not the ODBC Adminitrator. It is lightening fast !!! Will most certainly get my ISP to go to the latest version of MDAC !! OH DEAR - now I have set myself a problem - hehehehe Do I go for dBF files or for XML (see my post "Horses for Courses - may be of interest !!" in the watercooler) Just for the benefit of others that had not realised this, it means that there is another "Horse and Course" available for you. If you ISP is running IIS and has the latest version of MDAC installed, you do not need to go through the pain of getting them to install the dBase Run Time - just upload the DBF, DBT, NDX etc with the DSN file and ASP (Active Server Pages) files written in VBS (Visual Basic Script). I know that good folk like David Ball and Colyn and a few others will host dBase for you, but sadly not all ISPs are so farsighted or helpful !! Pete (Northolt UK) PS - Michael, I just never thought that Windows 2000 would have the latest MDAC - thank you for helping me to think a bit laterally. Michael Nuwer wrote: > Hi, > > There have been a few reports by people trying to connect to dBASE tables > with ASP scripts, but, since MDAC 2.5, the connection causes an error. Over > the last few days I have been working with ADO, dB2K and the Microsoft > documentation. I have been able to use DAO in dB2K to connect to an Access > database and to dBASE tables. I have also been able to connect to dBASE > tables with Visual Basic 6. I believe the Visual Basic syntax is similar to > ASP, so maybe this will help those like Peter Byers who have been have > problems. > > The code below was added to the onClick event handler of a pushbutton and it > produced the correct count of the records in a dBASE level 7 table. My > computer is running Windows 2000 and I have MDAC 2.6 installed. I used the > ODBC Administrator to create a system data source. I choose the Microsoft > dBASE driver. The DSN name is "dBASESamples" and it points to a folder with > dBASE level 7 tables. The table name I tested with is "Customer". I do not > know ASP, but perhaps someone who has been having problems could modify the > following VB code so as to test it with an ASP script. Please let me know > the results. > > -Michael Nuwer > > Dim objConn > Set objConn = CreateObject("ADODB.Connection") > objConn.ConnectionString = _ > "Provider=MSDASQL;DSN=dBASESamples;" > objConn.Open > Dim oCommand > Set oCommand = CreateObject("ADODB.Command") > oCommand.ActiveConnection = objConn > oCommand.CommandText = "Customer" > Dim oRs > Set oRs = CreateObject("ADODB.Recordset") > oRs.Open (oCommand) > nRecordCount = 0 > Do While Not oRs.EOF > nRecordCount = nRecordCount + 1 > oRs.MoveNext > Loop > MsgBox nRecordCount