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