Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2006, 05:48 PM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing variables to an access DB

I'm trying to pass variables from one application (lectora) into a simple access database. The database is named n395eval.mdb and the DSN connection on the web server is named MyTable_dsn.dsn. I keep getting 500 errors when trying to pass the simple variables. I made sure the database was modifiable to all "users". Can anyone see anything obvious in my code below?

<%@ Language=VBScript %>
<%

DIM score
DIM time
DIM date
DIM title

'Get the parameters posted from the lectora test titled "Final"'

score=Request.form("Final_Score")
time=Request.form("VarElapsedTime")
date=Request.form("VarCurrentDate")
title=Request.form("VarCurrentTitleName")


'First create Connection and Recordset objects'

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

    MyConn.Open "DSN=c:\program files\common files\odbc\data sources\myTable_dsn"

    Set Rs = Server.CreateObject("ADODB.RecordSet")




'Now, create the SQL statement'

    sSQL = "INSERT INTO MAIN(Score,time,date,title) VALUES ( '" & score & ", " & time & ", " & date & ", '" & title & ")"



'Execute the SQL statement, and set the recordset object to the result of this execution. We obtain the resulting records in Rs object'

    Set Rs = MyConn.Execute(sSQL)

'Close the Recordset object and destroy it'
    Set Rs = Nothing

'Release the resources for connection object'

    MYConn.Close
    Set MyConn = Nothing
%>

Thank you in advance for any input!
D'sarge

 
Old February 6th, 2006, 05:51 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

What error do you get exactly? A 500 error is quite generic an can be caused by a lot of problems...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 7th, 2006, 11:27 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Imar,

The exact message I'm receiving is:

Unable to post test data to host, cannot submit results! Server returned HTTP response code: 500 for URL: http://numdet01/courses/test/ironv2/submit.asp

The http path is correct. Thank you for helping me with this!!

Regards,
Dennis

 
Old February 7th, 2006, 02:55 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Strange, I have never seen that error before.

Can you show us a trimmed version of the code from the initial page with the form elements, and the ASP you post to and that must insert the data in the database?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Stay by Tricky (Track 1 from the album: Vulnerable) What's This?
 
Old February 8th, 2006, 03:39 PM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Imar,

I figured out my problem. Some of my column names in access were reserved variables. Once I changed the name to something like current_time instead of time, it worked fine.

Thank you for the input!!

Best Regards,
Dennis






Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variables CMOS Classic ASP Basics 2 January 22nd, 2006 07:38 PM
Passing variables karlirvin PHP How-To 4 December 2nd, 2005 08:02 PM
Passing variables jesseleon Access VBA 4 October 24th, 2003 01:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.