473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

type mismatch

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
%>
Jul 19 '05 #1
2 1557
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" <sh***@tampabay.rr.com> 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
%>


Jul 19 '05 #2
Hi,
"shank" <sh***@tampabay.rr.com> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
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
%>

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
5
by: kjworm | last post by:
Hello Everyone, I have been fighting with a type mismatch error for many hours today and I can't seem to find what the problem is. Hopefully it is more than a missing apostrophe! I have isolated...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.