Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > type mismatch

Reply
Thread Tools

type mismatch

 
 
shank
Guest
Posts: n/a
 
      07-27-2004
What is the proper use for CInt ..?
I get a type mismatch error whether I use it or not.
I assumed I needed it because I need to make sure Request("Qty") and
Request("Weight") were integers.

Also, does this loop structure appear to be correct. rsCart recordset is
just above this code.
thanks

<%
If Request("QtyUpdate") <> "" Then
Do While Not rsCart.EOF

varNewQty = CInt(Request("Qty")) <-- Type mismatch error

varNewWeight = varNewQty * CInt((rsCart.Fields.Item("Weight").Value))
Dim DataConn
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open MM_GenKAccess_STRING
SQL = "UPDATE Cart SET Cart.Qty = '" & varNewQty & "', Cart.Weight = '" &
varNewWeight & "' WHERE Cart.OrderNo = '" & varOrderNo & "'"
DataConn.Execute(SQL)
Loop
Response.Redirect("cart.asp")
End If
%>


 
Reply With Quote
 
 
 
 
BTR
Guest
Posts: n/a
 
      07-28-2004
Woah - why is your SQL statement in the loop? Everytime you iterate through the loop you run that SQL command - thats a serious performance issue.
Take all of this info out of the loop for one and see if that works.

I'm not sure what is happening above this so I dont know why your stuff is in the loop - post a little more so I can see what the page is doing

- Bastard



varNewQty = CInt(Request("Qty"))
varNewWeight = varNewQty * CInt((rsCart.Fields.Item("Weight").Value))

Dim DataConn
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open MM_GenKAccess_STRING

SQL = "UPDATE Cart SET
Cart.Qty = '" & varNewQty & "'
Cart.Weight ='" & varNewWeight & "'
WHERE Cart.OrderNo = '" & varOrderNo & "'"

DataConn.Execute(SQL)


If Request("QtyUpdate") <> "" Then
something..............
Response.Redirect("cart.asp")
End If


On Tue, 27 Jul 2004 18:24:33 -0400, "shank" <(E-Mail Removed)> wrote:

>What is the proper use for CInt ..?
>I get a type mismatch error whether I use it or not.
>I assumed I needed it because I need to make sure Request("Qty") and
>Request("Weight") were integers.
>
>Also, does this loop structure appear to be correct. rsCart recordset is
>just above this code.
>thanks
>
><%
>If Request("QtyUpdate") <> "" Then
> Do While Not rsCart.EOF
>
> varNewQty = CInt(Request("Qty")) <-- Type mismatch error
>
> varNewWeight = varNewQty * CInt((rsCart.Fields.Item("Weight").Value))
> Dim DataConn
> Set DataConn = Server.CreateObject("ADODB.Connection")
> DataConn.Open MM_GenKAccess_STRING
> SQL = "UPDATE Cart SET Cart.Qty = '" & varNewQty & "', Cart.Weight = '" &
>varNewWeight & "' WHERE Cart.OrderNo = '" & varOrderNo & "'"
> DataConn.Execute(SQL)
> Loop
> Response.Redirect("cart.asp")
>End If
>%>
>


 
Reply With Quote
 
 
 
 
Agoston Bejo
Guest
Posts: n/a
 
      07-28-2004
Hi,


"shank" <(E-Mail Removed)> wrote in message
news:u09k$(E-Mail Removed)...
> What is the proper use for CInt ..?
> I get a type mismatch error whether I use it or not.
> I assumed I needed it because I need to make sure Request("Qty") and
> Request("Weight") were integers.

[...]
> varNewQty = CInt(Request("Qty")) <-- Type mismatch error


Check if Request("Qty") is really a number and most of all if it is not ""
(empty string). Mostly this error occurs when Request(...) returns an empty
string because it itsn't passed.


> varNewWeight = varNewQty * CInt((rsCart.Fields.Item("Weight").Value))
> Dim DataConn
> Set DataConn = Server.CreateObject("ADODB.Connection")
> DataConn.Open MM_GenKAccess_STRING
> SQL = "UPDATE Cart SET Cart.Qty = '" & varNewQty & "', Cart.Weight = '" &
> varNewWeight & "' WHERE Cart.OrderNo = '" & varOrderNo & "'"
> DataConn.Execute(SQL)
> Loop
> Response.Redirect("cart.asp")
> End If
> %>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Type Mismatch error indexed name returns a value whose type does not match programmingzeal VHDL 0 05-06-2012 06:38 AM
type mismatch error amitbadgi@gmail.com ASP .Net 3 08-12-2005 11:23 AM
data type mismatch error amitbadgi@gmail.com ASP .Net 1 08-10-2005 01:04 PM
WORD shutdown - microsoft visual basic Run Time Error 13 - Type Mismatch frodo Computer Support 0 05-20-2004 05:39 PM
Type mismatch using Mozilla ActiveX in place of Microsoft WebBrowser? Noozer Firefox 0 05-19-2004 08:08 AM



Advertisments