help with dsn-less connection for asp-mdb


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: help with dsn-less connection for asp-mdb

  1. #1
    Join Date
    Dec 2008
    Posts
    13

    help with dsn-less connection for asp-mdb

    Get a 500 Internal server error when i try to make a dsn-less connection via asp to my hosted database. Can't figure out where the problem is Please help. I tried to troubleshoot the problem using a basic page that submits a hard coded value into the database to keep things simple. Thats the code i've provided here. Please point out where i'm going wrong.

    The path to the database was provided by my web host

    Code:
    <%@ Language="VBScript" %>
    <% Option Explicit %>
    <html>
    <head>
    <title>ASP for database</title>
    </head>
    <body>
    <%
    'declare variables
    Dim vdiagnosis, diagnosis, sConnString, connection, sSQL
    diagnosis = "fever"
    vdiagnosis = diagnosis
    
    'declare SQL statement that will query the database
    sSQL = "INSERT into patient (diagnosis) values ('" & vdiagnosis & "')"
    response.write (sSQL)
    'define the connection string, specify database driver and the location of database
    sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("D:\inetpub\vhosts\ozonekb.com\httpdocs\db\ozone.mdb")
    response.write (sConnString)
    'create an ADO connection object
    Set connection = Server.CreateObject("ADODB.Connection")
    
    'Open the connection to the database
    connection.Open(sConnString)
    
    'execute the SQL
    connection.execute(sSQL)
    
    response.write "The form information was inserted successfully."
    'Done. Close the connection object
    connection.Close
    Set connection = Nothing
    %>
    </body>
    </html>
    I've also tried with the alternative path ../db/ozone.mdb, but no results

  2. #2
    Join Date
    Dec 2008
    Posts
    13
    solved it - the error was a permissions problem with the database

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Thanks for coming back and letting us know.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. DSN Connection to Access
    By Kyle in forum ASP.NET
    Replies: 1
    Last Post: 10-02-2001, 07:30 PM
  2. Replies: 1
    Last Post: 06-28-2001, 06:53 PM
  3. DSN less ADO connection for Text Files
    By David Croft in forum VB Classic
    Replies: 2
    Last Post: 12-11-2000, 03:01 PM
  4. DSN Less connection to Access through RDO
    By Anoop in forum VB Classic
    Replies: 2
    Last Post: 10-31-2000, 06:09 AM
  5. ODBC - Connection to DSN Name failed
    By saiful in forum VB Classic
    Replies: 0
    Last Post: 04-13-2000, 08:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center