[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Type Mismatch in QueryString

Posted on 2001-06-18
5
Medium Priority
?
245 Views
Last Modified: 2010-07-27
Hi,
I'm using the following two snippets but keep getting a type mismatch error

Listing Page
"<TD BGCOLOR=""" & BCol & """ ALIGN=""right"">" & "<A HREF=""newsletter.asp?mode=deletemail&id=" & rs("MailHistoryID") & """>" & "Delete" & "</A>" & "</TD></TR>" & vbcrlf

Delete Page
If Request.QueryString("mode") = "deletemail" Then

intMailHistoryID = Request.QueryString("id")
strSQL = "DELETE * FROM MailHistory WHERE MailHistoryID = '" & intMailHistoryID & "'"

'Response.write intMailHistoryID
'Response.End

Conn.Execute(strSQL)

The response .write shows the value of the MailHistory id but the SQL won't execute because of the type mismatch.

Any help much appreciated.
0
Comment
Question by:gillmcd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Accepted Solution

by:
nilapenn earned 400 total points
ID: 6204889
If Mailhistoryid is integer then remove the single quotes

strSQL = "DELETE * FROM MailHistory WHERE MailHistoryID = " & intMailHistoryID
0
 
LVL 5

Expert Comment

by:gbaren
ID: 6204925
You have single quotes around an integer value. Single quotes specify a char value. Your type mismatch is from trying to set an integer column to a character value.
0
 
LVL 20

Expert Comment

by:Michel Sakr
ID: 6205351
you must remove the star:

strSQL = "DELETE FROM MailHistory WHERE MailHistoryID = " & intMailHistoryID

0
 
LVL 1

Expert Comment

by:yitz99
ID: 6205468
looks like you've got good suggestions above.

General tip - print out sql statements that give you trouble. ie:

response.write vbcrlf & "<!-- SQL: " & strSQL & "-->" & vbcrlf

that will troubleshoot it for you most of the time.
0
 

Author Comment

by:gillmcd
ID: 6205920
Thanks guys I learned a number of useful things from this.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question