Solved

Type Mismatch in QueryString

Posted on 2001-06-18
5
239 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 100 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:Silvers5
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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