ASP Help - Linking form to Access

Soldato
Joined
10 May 2004
Posts
3,790
Location
East Yorkshire, UK
Hi

I get a server 500 error on this code, does anyone know why?

PHP:
<%
'Dimension variables
Dim adoCon          'Holds the Database Connection Object
Dim rsAddComments   'Holds the recordset for the new record to be added
Dim strSQL          'Holds the SQL query to query the database 	
		


Set adoCon = Server.CreateObject("ADODB.Connection") 	
		

adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb") 	
		

adoCon.Open "DSN=database" 	
		

Set rsAddComments = Server.CreateObject("ADODB.Recordset") 	
		

strSQL = "SELECT order.FN, order.SN, order.AL1, order.AL2, order.AL3, order.PC, order.HN, order.MN, order.I1, order.I2, order.I3, order.I4, order.I5 FROM order;" 	
		

rsAddComments.CursorType = 2 	
		

rsAddComments.LockType = 3 	
		

rsAddComments.Open strSQL, adoCon 	
		

rsAddComments.AddNew 	
		

rsAddComments.Fields("FN") = Request.Form("FN")
rsAddComments.Fields("SN") = Request.Form("SN")
rsAddComments.Fields("AL1") = Request.Form("AL1")
rsAddComments.Fields("AL2") = Request.Form("AL2")
rsAddComments.Fields("AL3") = Request.Form("AL3")
rsAddComments.Fields("PC") = Request.Form("PC")
rsAddComments.Fields("HN") = Request.Form("HN")
rsAddComments.Fields("MN") = Request.Form("MN")
rsAddComments.Fields("I1") = Request.Form("I1")
rsAddComments.Fields("I2") = Request.Form("I2")
rsAddComments.Fields("I3") = Request.Form("I3")
rsAddComments.Fields("I4") = Request.Form("I4") 
rsAddComments.Fields("I5") = Request.Form("I5")  	
		

rsAddComments.Update 	
		

rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing 	
		

Response.Redirect "ordercomplete.html"
%>

Many Thanks
 
Last edited:
I can't see anything specifically wrong in the code, so it could be that the database is not in that location, the SQL has an incorrect field name or even ADO isn't installed.

If you change the IIS to show detailed error messages your browser will tell you the exact error and line number when you run it.
 
Back
Top Bottom