Solved

Type Mismatch in QueryString

Posted on 2001-06-18
5
234 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now