Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Access Pages Made Easy

Status
Not open for further replies.

buena

Programmer
Oct 17, 2001
47
0
0
US
I have an access 2002 db in which I created a data access page.
I uploaded the db and dap into a directory on my server.

I just want to be able to edit the db using the dap.

I cannot get this to work.

I have read through msdn articles and white papers and still cannot get it working.

Is there a simple way to do this?
 
I get the following errors:
1. Data provider could not be initalized
2. Not a valid file name

Then it displays #Name? in all of the fields.

Here is the page:

I basically just created the data access page within access and then uploaded that along with the db into the above directory.

I also changed the connection string to point to the db.
 
Here is what it looks like to me:
When someone clicks the link to access your Data Access page, the page attempts to connect to the Data Source which in the code on the Data Access Page is : "Data Source=C:\Documents and Settings\bspahr\Desktop\users.mdb;". This path is pointing back to your local machine where the database was created. Have you tried moving the database to a share on the webserver and changing the Data Source to to something like: " to reflect the new location?
 
Sorry, I just re-read your post. If you have already moved the database to the webserver then all you would need to do is change the Data Source to " as long as the database is in the same location as the Data Access Page.

Hope that helps!

Chuck
 
I still get the same error.

The dap and database are in the same dir.
 
Is it possible to connect to the db with the server.mappath method?
 
Did you change the Data Source path on the DAP? I'm still checking your source and it looks like it has not changed.
 
Refresh it. I was just experimenting with it.
 
I don't think the server.mappath method will work in this case unless your webserver supports ASP. Is this a hosted server or do you have complete control over it?
 
It is a hosted server and it does support asp.
 
You can check out ASP support by using the following code. It should work with your database but will require that the server administrator set up a DSN to point to your database.
Just create a test page and insert this code and be sure you save it with an ASP extension. Make sure there is a DSN created that is named "users" that is created on the server first:

Code:
<html><head>
<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=15
<TITLE>Current Issues:</TITLE>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<% 
' this code opens the database
myDSN=&quot;DSN=users;uid=Admin;pwd=&quot;
set conntemp=server.createobject(&quot;adodb.connection&quot;)
conntemp.open myDSN

' this code retrieves the data
mySQL=&quot;select * from issues&quot;
set rstemp=conntemp.execute(mySQL)

' this code detects if data is empty
If  rstemp.eof then
   response.write &quot;...There are currently no records to display...<br>&quot;
   
   conntemp.close
   set conntemp=nothing
   response.end
end if
%>
<table border=.1>
<%
' This code puts fieldnames into column headings
response.write &quot;<tr>&quot;
for each whatever in rstemp.fields
       response.write &quot;<td><B>&quot; & whatever.name & &quot;</B></TD>&quot;
next
response.write &quot;</tr>&quot;

' Now lets grab all the records
DO  UNTIL rstemp.eof
   ' put fields into variables
   username=rstemp(&quot;User_Name&quot;)
   password=rstemp(&quot;Password&quot;)
      
   
   ' write the fields to browser
   cellstart=&quot;<td align=&quot;&quot;top&quot;&quot;>&quot;
   response.write &quot;<tr>&quot;
   response.write cellstart & username & &quot;</td>&quot;
   response.write cellstart & password & &quot;</td>&quot;
   response.write &quot;</tr>&quot;
   rstemp.movenext
LOOP
%>
</table>

<%
' Now close and dispose of resources
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>
</body></html>
 
That was what I was trying to avoid in the first place.
I don't want to have to create the active serve pages or dsn on the server.

I just want to be able to upload the dap and db into a dir and be able to edit the db through the dap without creating the whole thing in asp.

Maybe this isn't possible, but that's what I was tyring to do.
 
Changing the Data Source should have worked. You might try changing it to: &quot;/users.mdb&quot; and see if that will do it. If not, not sure what to tell you if you don't want to go the DSN route.
 
I just tried switching the connection string. Same result.

I want it to work similair to a dsnless connection in a asp page. Where I don't have to make any changes on the server.

Since the server is hosted it becomes a pain to constantly request changes.
 
That was the very first thing I tried.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top