View Full Version : Web Form - Record Insert
HollyB
02-06-2008, 03:58 PM
I need help! I'm normally a compentant programmer but have somehow been totally thrown by asp. Problem is this:
I have a web form which from which I want to insert data into a new row in my server side Access database. 1azI'm using Dreamweaver 8and have tried using the 'insert' feature which when used anywhere on my pages leaves me with an HTTP 500 error when I try to view the page. What I need is someone to treat me like a total fool and guide me through step by step!
Thanks
Holly
angst
02-06-2008, 04:24 PM
ok, so your just trying to insert a record?
did u make the access connection string? are you able to select any records?
also, please go into your internet options/advanced, and disable "Friendly error messages". so we can see a real error message.
HollyB
02-06-2008, 05:18 PM
The connection string is all fine and I can view records no problem (sadly this is as far as our tutor took us on this subject which kinda leaves my knowledge sadly lacking).
This is the 'unfriendly' message....
Microsoft VBScript compilation error '800a03ee'
Expected ')'
/Thanks.asp, line 4
if(String(Request("business")) != "undefined"){ insertsponsor__business = String(Request("business"));}
-------------------------------^
angst
02-06-2008, 05:21 PM
ok, good.
now can u paste line 4 in here?
HollyB
02-06-2008, 05:28 PM
line 4 reads exactly :
if(String(Request("business")) != "undefined"){ insertsponsor__business = String(Request("business"));}
angst
02-06-2008, 05:31 PM
are you running this code in a asp file from the web server?
or is it vb/vbs?
HollyB
02-06-2008, 05:36 PM
the code runs on a confirmation page.
form on html, then posted to confirmation page - this script is in the header for this confirmation page. Asp on site is set up as ASP JScript.
angst
02-06-2008, 05:40 PM
ahh,, ok. thats important imformation to mention when posting for help.
I'll have to look around for the answer, this seems all wrong to me.
HollyB
02-06-2008, 05:44 PM
I'm glad it's not so straight forward and it's me being a ... well fill in the blank :p
angst
02-06-2008, 05:58 PM
ok, try this:
if(String(Request("business")) !== "undefined"){ insertsponsor__business = String(Request("business"));}
it's been along time since i used any JScript, but it should basicly be just vb/javascript.
HollyB
02-06-2008, 06:04 PM
thanks - will give it a go.
You've been a star :thumbsup:
HollyB
02-06-2008, 06:32 PM
pants. same error. :confused:
angst
02-06-2008, 06:33 PM
hmm... any chance I can see more of the header script? maybe I could test it on my comp.
HollyB
02-06-2008, 06:35 PM
i'd happily give you the keys to my car if you fix it lol
code is:
<!--#include file="Connections/DBCON.asp" -->
<%
if(String(Request("business")) !== "undefined"){ insertsponsor__business = String(Request("business"));}
if(String(Request("forename")) !== "undefined"){ insertsponsor__forename = String(Request("forename")));}
if(String(Request("surname")) !== "undefined"){ insertsponsor__surname = String(Request("surname")));}
%>
<%
var insertsponsor = Server.CreateObject("ADODB.Command");
insertsponsor.ActiveConnection = MM_DBCON_STRING;
insertsponsor.CommandText = "INSERT INTO Sponsors ("+ insertsponsor__business.replace(/'/g, "''") + ", "+ insertsponsor__forename.replace(/'/g, "''") + ", "+ insertsponsor__surname.replace(/'/g, "''") + ") VALUES ('"+ insertsponsor__business.replace(/'/g, "''") + "','"+ insertsponsor__forename.replace(/'/g, "''") + "','"+ insertsponsor__surname.replace(/'/g, "''") + "') ";
insertsponsor.CommandType = 1;
insertsponsor.CommandTimeout = 0;
insertsponsor.Prepared = true;
insertsponsor.Execute();
%>
Spudhead
02-06-2008, 06:38 PM
Microsoft VBScript compilation error '800a03ee'
Asp on site is set up as ASP JScript.
If ASP is set up as JSCRIPT, why are you getting error messages from the VBScript parser?
I'm no JSCRIPT coder either but... try wrapping your code in:
<script language="jscript" runat="server">
rather than the usual ASP delimiters, and see if that at leasts gets you error message from the right parsing engine...
angst
02-06-2008, 06:41 PM
lol.. well, i'll try.
now lets go back to basics. can we just use classic asp for this instead?!
If NOT Request("business") = "undefined" Then insertsponsor__business = Request("business")
If NOT Request("forename")= "undefined" Then insertsponsor__forename = Request("forename")
If NOT Request("surname") = "undefined" Then insertsponsor__surname = Request("surname")
(crosses fingers)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.