Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 1st, 2005, 12:06 PM
Authorized User
 
Join Date: Jul 2005
Location: Mishawaka, IN, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
  #2 (permalink)  
Old July 1st, 2005, 12:15 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You have a JavaScript error somewhere in your script. It is not referring to your Insert.

  #3 (permalink)  
Old July 1st, 2005, 01:06 PM
Authorized User
 
Join Date: Jul 2005
Location: Mishawaka, IN, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
  #4 (permalink)  
Old July 1st, 2005, 01:10 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Seems you are using classic ASP code. This is .NET forum. Are you creating a .asp or .aspx page?

  #5 (permalink)  
Old July 1st, 2005, 02:10 PM
Authorized User
 
Join Date: Jul 2005
Location: Mishawaka, IN, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually if you look at the title of this forum says "ASP and ASP.NET".

Anyways.. I am creating a .asp page.
  #6 (permalink)  
Old July 1st, 2005, 02:16 PM
Authorized User
 
Join Date: Jul 2005
Location: Mishawaka, IN, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I See my bad I am in the ASPX section. Can you still help?

  #7 (permalink)  
Old July 1st, 2005, 02:19 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am more familiar with .NET. Perhaps you will get a better and quicker response from on of the ASP forums.

  #8 (permalink)  
Old July 1st, 2005, 02:33 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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
  #9 (permalink)  
Old July 1st, 2005, 02:40 PM
Authorized User
 
Join Date: Jul 2005
Location: Mishawaka, IN, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In my original post I said I tried that and still got the same error message.
  #10 (permalink)  
Old July 5th, 2005, 09:53 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Using For Next Statement slbibs ASP.NET 2.0 Professional 9 September 19th, 2008 09:44 AM
Trouble with IF statement jazzcatone Classic ASP Basics 1 October 19th, 2005 04:43 AM
Trouble executing SQL statement turbo_rabbit Classic ASP Databases 6 July 6th, 2005 01:30 PM
Trouble with SQL statement jsanders ASP.NET 1.0 and 1.1 Basics 1 May 24th, 2005 03:11 PM
Trouble with mysql statement cbright JSP Basics 1 October 2nd, 2003 06:22 AM



All times are GMT -4. The time now is 11:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.