ASP <=> Paradox

How can I set up a ADO connection directly to a paradox database (containing 4 tables (8 files)) in an ASP?
rderidderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mgfranzCommented:
<!— #Include file="ADOVBS.INC" —>
<% Language = VBScript %>
<HTML><HEAD>
<TITLE>ADO 1.5 Open Method</TITLE></HEAD>
<BODY>
<FONT FACE="MS SANS SERIF" SIZE=2><Center><H3>ADO AddNew Method</H3>
<!— ADO Connection Object used to create recordset—><%
'Create and Open Connection Object
Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
OBJdbConnection.Open "AdvWorks"
'Create and Open Recordset Object
Set RsCustomerList = Server.CreateObject("ADODB.Recordset")
RsCustomerList.ActiveConnection = OBJdbConnection
RsCustomerList.CursorType = adOpenKeyset
RsCustomerList.LockType = adLockOptimisticRsCustomerList.Source = "Customers"
RsCustomerList.Open%>
<!— If this is the first time the page is opened, the Form collection will be empty when data is entered run AddNew method—><%
If Not IsEmpty(Request.Form) Then
    If Not Request.Form("CompanyName") = "" Then        
        RsCustomerList.AddNew
        RsCustomerList("CompanyName") = Request.Form("CompanyName")
        RsCustomerList("ContactLastName") = Request.Form("LastName")
        RsCustomerList("ContactFirstName") = Request.Form("FirstName")
        RsCustomerList("PhoneNumber") = Request.Form("PhoneNumber")
        RsCustomerList("City") = Request.Form("City")
        RsCustomerList("StateOrProvince") = Request.Form("State")
        RsCustomerList.Update        
        RsCustomerList.MoveFirst                End IfEnd If%>
<TABLE COLSPAN=8 CELLPADDING=5 BORDER=0>
<!— BEGIN column header row for Customer Table—>
<TR><TD ALIGN=CENTER BGCOLOR="#008080">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Company Name</FONT></TD>
<TD ALIGN=CENTER BGCOLOR="#008080">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Contact Name</FONT></TD>
<TD ALIGN=CENTER WIDTH=150 BGCOLOR="#008080">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Phone Number</FONT></TD>
<TD ALIGN=CENTER BGCOLOR="#008080">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>City</FONT></TD>
<TD ALIGN=CENTER BGCOLOR="#008080">
<FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>State/Province</FONT></TD></TR>
<!—Display ADO Data from Customer Table One row on each pass through recordset—>
<% Do While Not RsCustomerList.EOF %>    <TR><TD BGCOLOR="f7efde" ALIGN=CENTER>
  <FONT STYLE="ARIAL NARROW" SIZE=1>
      <%= RSCustomerList("CompanyName")%>       </FONT></TD>
  <TD BGCOLOR="f7efde" ALIGN=CENTER>      <FONT STYLE="ARIAL NARROW" SIZE=1>
      <%= RScustomerList("ContactLastName") & ", " %>
      <%= RScustomerList("ContactFirstName") %>       </FONT></TD>
  <TD BGCOLOR="f7efde" ALIGN=CENTER>      <FONT STYLE="ARIAL NARROW" SIZE=1>
     <%= RScustomerList("PhoneNumber")%>      </FONT></TD>
  <TD BGCOLOR="f7efde" ALIGN=CENTER>      <FONT STYLE="ARIAL NARROW" SIZE=1>
      <%= RScustomerList("City")%>       </FONT></TD>
  <TD BGCOLOR="f7efde" ALIGN=CENTER>      <FONT STYLE="ARIAL NARROW" SIZE=1>
      <%= RScustomerList("StateOrProvince")%>       </FONT></TD></TR>
<!— Next Row = Record Loop and add to row html table—><%
RScustomerList.MoveNext Loop %></TABLE><HR>
<!— Form to enter new record posts variables back to this page —><Table>
<Form Method = Post Action="AddNew.asp" Name=Form><TR><TD><P>Company Name:</TD>
<TD><Input Type="Text" Size="50" Name="CompanyName" Value = ""></P></TD>
<TR><TD><P>Contact First Name:</TD>
<TD><Input Type="Text" Size="50" Name="FirstName" Value = ""></P></TD>
<TR><TD><P>Contact Last Name:</TD>
<TD><Input Type="Text" Size="50" Name="LastName" Value = ""></P></TD>
<TR><TD><P>Contact Phone:</TD>
<TD><Input Type="Text" Size="50" Name="PhoneNumber" Value = ""></P></TD>
<TR><TD><P>City:</TD>
<TD><Input Type="Text" Size="50" Name="City" Value = ""></P></TD>
<TR><TD><P>State / Province:</TD>
<TD><Input Type="Text" Size="5" Name="State" Value = ""></P></TD>
<TR><TD><Input Type="Submit" Value="Add New "><Input Type="Reset" Value="Reset Form">
</Form></Table></Center></FONT>
<%'Show location of DSN data source
Response.Write(OBJdbConnection)%>
<Script Language = "VBScript">Sub Form_OnSubmit
    MsgBox "Sending New Record to Server",,"ADO-ASP _Example"
      End Sub
      </Script>
</BODY></HTML>
0
mgfranzCommented:
I should have included the correct ODBC driver;

Driver={Microsoft Paradox Driver *.db)};DBQ=physical path to .db file;DriverID=26
0
rderidderAuthor Commented:
Could you tell me where exactly this Driver line should go?
Say the file will be in the current directory (the same as the ASP), and there are db files for Inventory, Warehouse, Employee, and Location.
Thanks,
rderidder
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

rderidderAuthor Commented:
And, I am assuming this microsoft driver comes included with IIS, or NT, and I don't have to find it anywhere?

THanks,
rderidder
0
mgfranzCommented:
Are you going to use Server DSN connections?  Or do you want these conections to be DSNless?  Are you going to Join or Link these tables?
0
mgfranzCommented:
You assume correctly.
0
rderidderAuthor Commented:
I was going to have them DSNless, not even using ODBC if possible?
Is there a way to use a virtual directory set up on the webserver? - Doubt it. Otherwise, no..DSNless.

No joins. SImple queries involving one table at a time - 4 database connections going I guess.
0
mgfranzCommented:
This is what I use for DSNless connections; ( I have edited it for your Paradox connection.  You must use the physical path to the db file.

<%
Dim objDC, objRS

' Open the DNSless connection
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.ConnectionTimeout = 30
objDC.CommandTimeout = 60
objDC.Open "DBQ=" & Server.MapPath("YourdBfilePath") & ";Driver={Microsoft Paradox Driver *.db)};"
Set objRS = Server.CreateObject("ADODB.Recordset")
%>

Mark
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rderidderAuthor Commented:
One last detail..

Shouldn't ".\file.db" work as the path to the current directory (the directory where the ASP resides)?

How can I create the ASP so that it can be installed on different machines, with different directory structures, and package it with the db files, and not have to worry about changing the code to reflect the different directory structures?

It seems ".\file.db" doesn't work.
0
rderidderAuthor Commented:
Actually, it seems I can use a virtual directory in the server.mappath. SO I can set up the IIS web server to have this virtual directory and point it to wherever I want.
Perfect.
Thanks
0
mgfranzCommented:
Is file.db located in the same directory path as the .asp file?  If so you can use this, "./file.db" or "file.db".  Other wiase use common UNC paths.  If there is a directory under the .asp page called data, and the dB file is locted there, use the path "./data/file.db" or "/data/test.db"  

As to your secong part it is up to you to package the directory paths, or you can create paths dynamically using FSO... but o really don't want to get into this right now...  it would require a bit of work. Other than that you will have to set the paths to the dB if the tree's are diferent on each machine.

Mark
0
mgfranzCommented:
Yup... you can do that!  :-)
0
rderidderAuthor Commented:
One more problem with this..
Hope you are still reading...
It works fine on my Win 98 , with a personal web server.
But now that I've tried it on my web server with IIS, it is not working.

I get :
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I think it is a driver thing. Does this method use the ODBC driver ODBCJT32.dll?
The IIS server has this driver, so I don't know what is wrong.

The open string I use is:
objDC.Open "DBQ=" & Server.MapPath(".\location.db") & ";Driver={Microsoft Paradox Driver *.db)};"

Though, I've even tried a direct path, without the mappath thing. Still doesn't work.
I don't get why it is telling me about data sources...

Is there an issue with IIS and ISAM drivers??
0
mgfranzCommented:
What version of ODBC are you using?  You will be able to check to see if the Paradox driver is even loaded by looking in the ODBC properties under drivers.  You may have to update the ODBC driver.

Here is a great reference for the error you are recieving.

http://support.microsoft.com/support/kb/articles/Q183/0/60.ASP
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.