|
|
 |
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.
|
 |

December 10th, 2004, 09:47 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

December 10th, 2004, 10:05 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Does the Internet User account have access to the folder that the DB is in?
|

December 10th, 2004, 11:19 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

December 10th, 2004, 12:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
What OS do you have? Can you see the security tab when you right click the folder the DB is in?
|

December 10th, 2004, 12:30 PM
|
|
Authorized User
|
|
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

December 10th, 2004, 02:02 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
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.
|

December 10th, 2004, 05:16 PM
|
|
Authorized User
|
|
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

December 10th, 2004, 05:43 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
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.
|

December 10th, 2004, 06:02 PM
|
|
Authorized User
|
|
Join Date: Aug 2003
Location: Nicholasville, KY, USA.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

December 13th, 2004, 09:11 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Any time you need to write to the database you will have to give permissions to the Internet User account.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |