|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
|
|
|
July 1st, 2005, 12:06 PM
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Trouble executing SQL statement
I an very new to ASP (this week to be exact, been doing Coldfusion), and so far I have liked coding with it. Anyway here is my problem.
I am tring to do an insert statement with the following code:
<%
var AddJob = Server.CreateObject("ADODB.Recordset");
AddJob.ActiveConnection = MM_nafpinc_DSN_STRING;
strsql ="INSERT INTO members (DateAdd,JobTitle,JobDescription) VALUES ('7/1/2005','Test','test')"
AddJob.Execute strsql
%>
Here is the error that is generated when I try to load the page:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/nafpinc/_admin/employment-act.asp, line 15
AddJob.Execute strsql
I have tried putting in the ';', but I still receive the same error message.
|
July 1st, 2005, 12:15 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
You have a JavaScript error somewhere in your script. It is not referring to your Insert.
|
July 1st, 2005, 01:06 PM
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Like I said I am new so if you could point out my error I would appreiate it. I don't see where there can be an error in my script when other than the connection string that is the only code on the page.
The following is the code for the entire page:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var AddJob = Server.CreateObject("ADODB.Recordset");
AddJob.ActiveConnection = MM_nafpinc_DSN_STRING;
strsql ="INSERT INTO members (DateAdd,JobTitle,JobDescription) VALUES ('7/1/2005','Test','test')"
AddJob.Execute strsql
//qDeleteJob.CursorType = 0;
//qDeleteJob.CursorLocation = 2;
//qDeleteJob.LockType = 1;
//**leave comment** qDeleteJob.Open();
//var qDeleteJob = 0;
%>
<% Response.Write(strsql) %>
There is nothing wrong with the "nafpinc_DSN.asp" file. It is used on all my other pages and works fine.
|
July 1st, 2005, 01:10 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Seems you are using classic ASP code. This is .NET forum. Are you creating a .asp or .aspx page?
|
July 1st, 2005, 02:10 PM
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Actually if you look at the title of this forum says "ASP and ASP.NET".
Anyways.. I am creating a .asp page.
|
July 1st, 2005, 02:16 PM
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I See my bad I am in the ASPX section. Can you still help?
|
July 1st, 2005, 02:19 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
I am more familiar with .NET. Perhaps you will get a better and quicker response from on of the ASP forums.
|
July 1st, 2005, 02:33 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
You are missing ; on the end of the following statements.
strsql ="INSERT INTO members (DateAdd,JobTitle,JobDescription) VALUES ('7/1/2005','Test','test')"
AddJob.Execute strsql
|
July 1st, 2005, 02:40 PM
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In my original post I said I tried that and still got the same error message.
|
July 5th, 2005, 09:53 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Ok, my bad.
The compiler is probably seeing "AddJob.Execute" without the () and expecting a following ";". Perhaps then the Execute method needs ( )?
AddJob.Execute(strsql);
- Peter
|
|
|