Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    104

    Unanswered: Access Automation from ASP

    Hello again. How can I direct an access database from my asp application? I am afraid that the way is not the same as is from word or excel (OLE automation).I tried to use the code that I have written, in my asp page, but it stopped in third line (db.OpenCurrentDatabase...) with none specific error message from IIS. However, the specific line run perfectly under word and excel vba.Why?

    Dim db
    set db=Server.CreateObject("Access.Application")
    db.OpenCurrentDatabase Path & "\Data.mdb", False
    db.DoCmd.OutputTo acOutputReport, "rptSomeReport",acFormatSNP, Path & "rptSomeReport.snp", True
    Last edited by NonLinear; 01-27-05 at 08:56.

  2. #2
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Here is something I put together about ASP that hopefully might help somehow.

    You and others can have access to a database hosted on the Web from any location that has a browser with an Internet connection.

    The Web database concept makes sense if you and your people want to do work in various locations in or outside the office and still be "plugged" in.

    For example you could have employees enter timesheets or have sales reps log their contacts. Or perhaps you'd like customers to be able to check the status of their orders online without having to call the company.

    If you want a Web database, typically what would happen is that a database such as Access or MySQL (basically just consisting of tables) would be put on the Web.

    Then "dynamic" Web pages (such as classic ASP pages which include VBScript, HTML, and/or JavaScript) would be created acting like the old desktop database's queries, forms, and reports to access the database - all hosted on a Web Server.

    Dynamic Web pages are similar in many ways to regular HTML pages. But they are "live" because the user can read from and write to information in the database. An example where you can login and add, edit, or view fictional customers and invoices is at http://www.bullschmidt.com/login.asp

    Not all Web hosts will handle dynamic Web pages but many do. The Web hosts that can handle ASP pages usually have a Windows 2000 or Windows 2003 operating system running an IIS Web server.

    Here are a few good ASP sites:
    o ASP101 Samples - http://www.asp101.com/samples
    o W3Schools ASP Tutorial - http://www.w3schools.com/asp
    o Microsoft VBScript Language Reference - http://msdn.microsoft.com/scripting/...bscripttoc.htm

    And the following newsgroup is good:
    microsoft.public.inetserver.asp.general

    Or for a "quick and dirty" generic ASP open source solution to putting databases on the Web (often works well for the admin area of a Web site which doesn't need to look too unique) that just requires setting up a configuration page for each table or query and uploading the database to the Web as long as there is an autonumber field in each table (and you'll probably also separately want to create login capabilities), perhaps try something like this:
    GenericDB by Eli Robillard
    http://www.genericdb.com and then click on the Tips link to see an example
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Feb 2004
    Posts
    104
    Sorry but this answer maybe refer to other question. My question was very specific. And something else, the second line (set db=Server.CreateObject("Access.Application")) in my code it works. I checked that from windows task manager in Processes tab where I saw that access instant was running when my asp page started (I run my asp application on my PC with winXP and IIS 5.0).

  4. #4
    Join Date
    Jan 2005
    Posts
    36
    It doesn't work because the code you have is unrecognizable by asp. OLE automation and ASP are totally different things.

    What are you trying to do with the access db - maybe I can help you with the right asp code.

  5. #5
    Join Date
    Feb 2004
    Posts
    104
    I have an objection about the "OLE automation and ASP are totally different things" sentence that maybe helps in our conversation.
    They are really different things, but this doesn't mean that it can not exist collaboration between them. Furthermore, the ASP technology became very popular for that same reason. The ability, that asp have, to make collaborations between different technologies. To prove it I say that the OLE automation working perfectly between asp and excel. I have written an xl code in my asp page and it works with any problem. It is very simple, just create an xl instance with server.createObject("Excel.Application") and then you can fill cells, execute macro and do anything in xl from asp code. I want to manage, with the same way, the access built-in statements and objects like DoCmd from asp to export a report to .snp format (snapshot). My question is very clearly.
    Thanks

  6. #6
    Join Date
    Jan 2005
    Posts
    36
    alrighty then.

    Sounds like you have it all figured out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •