p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 10th, 2004, 09:47 AM
Authorized User
Points: 197, Level: 3
Points: 197, Level: 3 Points: 197, Level: 3 Points: 197, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default INSERT INTO error

I have already checked the following topic from Stephan - http://p2p.wrox.com/topic.asp?TOPIC_...s=INSERT,error.

I am having similar problems but have not been able to correct the problem.

Unlike Stephan, I have connected to the database using a DSN-less connection and it seems to be working fine from the DisplayStock.asp page.

The BuyItem.asp page also seems to work. It is picking up the StockID passed thru the URL.

The error occurrs when trying to perform the INSERT INTO sql.

Here is the error I receive:
_______________________________________________
Technical Information (for support personnel)

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/WROXDBSample/AddOrderDetails.asp, line 29


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.40607)

Page:
POST 151 bytes to /WROXDBSample/AddOrderDetails.asp

POST Data:
txtStockID=5&txtCustomerName=Thomas+Seroogy&txtCus tomerAddress=201+Christa+Lane%2C+Nicholasville%2C+ KY+40356&txtTelNumber=8599835958&submit1=Send+Orde r

Time:
Friday, December 10, 2004, 8:34:15 AM
__________________________________________________ _______


my script for the AddOrderDetails.asp page are as follows:

Code:
<%@ LANGUAGE = JavaScript %>
<html>
<head>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<%

    var month = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Nov", "Dec");
    var nowDate = new Date();
    var nowDate = nowDate.getDate() + " " + month[nowDate.getMonth()] + " " + nowDate.getFullYear();
    var orderNo;

    var myDb = "F:\\dB";
    var adoRecordSet;
    var mySQL;

var adoConnection = Server.CreateObject("ADODB.Connection");

adoConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + myDb + "\\CompBitsCo.mdb");

mySQL = "INSERT INTO CustomerOrder(CustomerName, CustomerAddress, TelNumber, OrderDate)";
mySQL = mySQL + " VALUES('" + Request.Form("txtCustomerName") + "','";
mySQL = mySQL + Request.Form("txtCustomerAddress") + "','";
mySQL = mySQL + Request.Form("txtTelNumber") + "','";
mySQL = mySQL + nowDate + "')";

adoConnection.Execute(mySQL);

mySQL = "SELECT Max(OrderNo) AS MaxOrderNo FROM CustomerOrder WHERE ";
mySQL = mySQL + " OrderDate = #" + nowDate + "# AND ";
mySQL = mySQL + " CustomerName = '" + Request.Form("txtCustomerName") + "'";

adoRecordSet = adoConnection.Execute(mySQL);

orderNo = adoRecordSet("MaxOrderNo").Value;

adoRecordSet.Close();
adoRecordSet = null;

mySQL = "INSERT INTO OrderItem (OrderNo, StockID, QtyOrdered)";
mySQL = mySQL + " VALUES (" + orderNo + ",";
mySQL = mySQL + Request.Form("txtStockId") + ",";
mySQL = mySQL + "1)";

adoConnection.Execute(mySQL);

adoConnection.Close();
adoConnection= null;

Response.Write("<h2><center>Your order has completed successfully</center></h2>");

%>

</body>
</html>

Any help is appreciated.

Best regards,
sabertec2

PS - You can access all of the pages by going to www.saber-tool.com/displaystock.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old December 10th, 2004, 10:05 AM
Friend of Wrox
Points: 2,549, Level: 20
Points: 2,549, Level: 20 Points: 2,549, Level: 20 Points: 2,549, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Does the Internet User account have access to the folder that the DB is in?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old December 10th, 2004, 11:19 AM
Authorized User
Points: 197, Level: 3
Points: 197, Level: 3 Points: 197, Level: 3 Points: 197, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I believe so.

I am the administrator, and I have been running the trial from my computer. The DB is on a separate harddrive attached to this computer.

Thinking it may have to do with permissions (I know very little about permissions), I experimented by changing the Web Sharing properties. But no luck.

My last attempt was to locate the database in the web's root directory. Still no luck. Same error message.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old December 10th, 2004, 12:08 PM
Friend of Wrox
Points: 2,549, Level: 20
Points: 2,549, Level: 20 Points: 2,549, Level: 20 Points: 2,549, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What OS do you have? Can you see the security tab when you right click the folder the DB is in?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old December 10th, 2004, 12:30 PM
Authorized User
Points: 197, Level: 3
Points: 197, Level: 3 Points: 197, Level: 3 Points: 197, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

XP Pro SP2. Yes, I can see the Sharing & Security. This is where I experimented by selecting single and then all of the permissions check boxes under the Web Sharing tab.

Still, shouldn't I have access to the DB when it is in the root directory?

Thanks for working on this!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old December 10th, 2004, 02:02 PM
Friend of Wrox
Points: 2,549, Level: 20
Points: 2,549, Level: 20 Points: 2,549, Level: 20 Points: 2,549, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Click on the security tab and make sure the Internet User account for your machine has access to write to the DB folder.

You should have admin but the I_USR<machine_name> account is what needs access.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old December 10th, 2004, 05:16 PM
Authorized User
Points: 197, Level: 3
Points: 197, Level: 3 Points: 197, Level: 3 Points: 197, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no SECURITY tab - per se. Only SHARING and WEB SHARING tabs. Am I looking in the wrong place (I right click the folder and go to properties)?

I also tried making the WRITE changes to the folder and file through IIS. Still a no go.

I went to MSDN to check on this error. Error seems common with IUSER_MACHINE permissions being the most common problem. I'm not knowledgeable enough on permissions to make these changes without guidance.

Still, this won't help if it works on my machine but not when it's deployed to my hosting IS server.

PS - I tried running a very basic INSERT and UPDATE SQL script to a simple flat table. Still, no luck - the very same error.

Seems MS Access may not be the best DB tool with which to learn. Still, SQL is way more than I need for my simple application.

Any guidance is still happily accepted.

Best regards,
TSeroogy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old December 10th, 2004, 05:43 PM
Friend of Wrox
Points: 2,549, Level: 20
Points: 2,549, Level: 20 Points: 2,549, Level: 20 Points: 2,549, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Open 'My Computer'. Click 'Tools' and then 'Folder Options'. Then click on the 'View' Tab and scroll all the way to the bottom. Uncheck 'Use Simple File Sharing(Recommended)' and click 'Ok' or 'Yes' to the warning.

Once that has been done you should be able to go the the folder where your file will be created and right click on the folder and give the internet user account write access to the folder.

You must be using NTFS and NOT FAT16 or FAT32.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old December 10th, 2004, 06:02 PM
Authorized User
Points: 197, Level: 3
Points: 197, Level: 3 Points: 197, Level: 3 Points: 197, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the guidance. It did work.

I assume this means that the folder permissions will have to be changed on the server to where this is eventually deployed?

Thanks for your patience.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #10 (permalink)  
Old December 13th, 2004, 09:11 AM
Friend of Wrox
Points: 2,549, Level: 20
Points: 2,549, Level: 20 Points: 2,549, Level: 20 Points: 2,549, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Any time you need to write to the database you will have to give permissions to the Internet User account.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 12:17 PM
Insert Error FishBoy SQL Server ASP 2 April 7th, 2008 07:45 AM
Syntax error INSERT INTO ITladybug ADO.NET 2 January 31st, 2006 07:50 AM
HELP! Insert Query Error zrm22 Classic ASP Databases 1 January 30th, 2006 06:34 PM
INSERT INTO error akibaMaila Beginning VB 6 1 January 13th, 2005 02:44 PM



All times are GMT -4. The time now is 10:54 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc