Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
What is wrong with these 5 lines of script?
Old 06-19-2008, 05:06 PM What is wrong with these 5 lines of script?
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Code:
 
Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open ("c:/inetpub/wwwroot/HawksWeb/Data/WebData.mdb")
SQL = "Insert Into Cart (CustID,ProdID,Qty) Values ('"&CustID&"','"&ProdID&"','"&Qty&"')"
conn.Execute(SQL) 
Set conn=nothing
I know it must be simple, but I am at my wits end! cannot get an error, server side script via AJAX. Had this working fine until the electricians knocked out the power and my computer.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-19-2008, 05:29 PM Re: What is wrong with these 5 lines of script?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Dynamic SQL is what's wrong with it. You have code that writes code. We don't know if it's the code you've written and shown us above, or the code that it writes, which is even causing the problem! It could easily be that one of the string values you're trying to insert has a ' in it, or some other character with a special meaning. It could be the wrong type delimiter all together. Or something entirely different.

The solution to this particular problem is to save an "action query" to your Access database, and parametrize it. Then bind your ASP code to those parameters.

That may or may not get the code above working the way you'd expect, but if you had taken that approach, right now you would know whether it's a database problem or an ASP AJAX problem. Or, rather, once you'd tested your "action query", you would know that wasn't the source of the problem. (And if it is, that would mean you'd have no problem at all!)

Server.MapPath is better than a fully qualified path for somewhat similar reasons. If the file doesn't exist in that location, it would break your code. If, instead, you issued a call to open Server.MapPath("~/Data/WebData.mdb") besides just being easier, if your site was moved on the physical disc and IIS was updated, things would still just work.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-19-2008, 07:36 PM Re: What is wrong with these 5 lines of script?
RabidSniper's Avatar
Skilled Talker

Posts: 57
Name: Jesse
Location: Phoenix, AZ
Trades: 0
Yeah.. everything he just said!
RabidSniper is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to What is wrong with these 5 lines of script?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11995 seconds with 12 queries