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
I have solved my previous mismatch error and have a new one!
Old 06-10-2008, 01:56 AM I have solved my previous mismatch error and have a new one!
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I have a good understanding of this one, but no solution.

Code:
 
<script language="vbscript" runat="server">
CustID=Request.QueryString("CustID")
ProdID=Request.QueryString("ProdID")
OrderID=Request.QueryString("OrderID")
Qty=Request.QueryString("Qty")
Desc=Request.QueryString("Desc")
Per=Request.QueryString("Per")
Shp=Request.QueryString("Shp")
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; "& "Data Source=" & Server.MapPath("/Data/Orders.mdb")
Set OrderData=Server.CreateObject("ADODB.RecordSet")
OrderData.CursorType = 3
OrderData.CursorLocation = 3
OrderData.ActiveConnection = conn
OrderData.Open("Select OrderID From Orders where CustomerID='"+CustID+"'")
If OrderData.EOF then
OrderData.Close
SQL = "Insert Into Orders (CustomerID) Values('"+CustID+"')"
conn.Execute SQL 
OrderData.Open("Select OrderID From Orders where CustomerID='"+CustID+"'")
OrdID= OrderData.Fields("OrderID")
OrdID=cstr(OrdID)
OrderData.Close
Else
OrdID= OrderData.Fields("OrderID")
OrdID=cstr(OrdID)
Qty=cstr(Qty)
ProdID=cstr(ProdID)
Desc=cstr(Desc)
Per=cstr(Per)
Shp=cstr(Shp)
OrderData.Close
End If 
SQL = "Insert Into Items (OrderID,Qty,ProductID,Desc,Per,Shp) Values('"+OrdID+"','"+Qty+"','"+ProdID+"','"+Desc+"','"+Per+"','"+Shp+"')"
conn.Execute SQL 
Set conn=nothing
RespStr= "The item has been added to your cart! You will have an opportunity at check-out to modify your order if you wish."
Response.Write(RespStr)
</script>
Everything is fine up to the Per and Shp vars,
I had to convert everything to strings because even though they started out as strings, when passed by QueryString vb interprets the "numeric strings" as numbers (great deal of time on that one!) Per and Shp are Decimal values(actually represent currency) such as "1.99" and ".39". Even though they have been converted to strings they create a syntax error in the highlighted script. What am I to do now? Please note all the values excepting Desc are also numbers, just no decimals.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-10-2008, 08:10 AM Re: I have solved my previous mismatch error and have a new one!
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
cint() & cstr()
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-10-2008, 08:16 AM Re: I have solved my previous mismatch error and have a new one!
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Thx again Chris, I learned from my prior post that those are bandaids for my improper use of "+" for string concatenation. All those "+"'s have now been replaced with "&" and I no longer need the code cstr(). I am still having the same problem with "Per" and "Shp" though.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 06-10-2008, 11:29 AM Re: I have solved my previous mismatch error and have a new one!
nyef's Avatar
Ultra Talker

Posts: 265
Name: Lucas
Trades: 0
One of your field names, Desc, is a SQL reserved keyword.

Change the insert line to this (notice the brackets):
Code:
SQL = "Insert Into Items (OrderID,Qty,ProductID,[Desc],Per,Shp) Values(" & OrdID & "," & Qty & "," & ProdID & ",'" & Desc & "'," & Per & "," & Shp & ")"
__________________
~nyef

Please login or register to view this content. Registration is FREE
nyef is offline
Reply With Quote
View Public Profile Visit nyef's homepage!
 
Old 06-10-2008, 03:43 PM Re: I have solved my previous mismatch error and have a new one!
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Wow, I'm noticing nyef is pretty good with the Microsoft dev tools?
__________________

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-10-2008, 03:48 PM Re: I have solved my previous mismatch error and have a new one!
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I'm noticing nyef is pretty good at coding. I am fairly sure his reserved word solution is right on the money. haven't tried it yet, I have smudged up my site a bit while cleaning it up.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 06-12-2008, 12:01 AM Re: I have solved my previous mismatch error and have a new one!
nyef's Avatar
Ultra Talker

Posts: 265
Name: Lucas
Trades: 0
Happy to help =) Let us know if you run into any further problems.
__________________
~nyef

Please login or register to view this content. Registration is FREE
nyef is offline
Reply With Quote
View Public Profile Visit nyef's homepage!
 
Reply     « Reply to I have solved my previous mismatch error and have a new one!
 

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.20876 seconds with 12 queries