Solved

Type Mismatch in QueryString

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Add server behaviors to Dreamweaver CC 2015 2 185
Live mode in DW, need to creae Session 4 107
Question about ASP Including Files 6 61
Hide Table in merge 3 31
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

856 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