hi
i have a source code that check some email address and deactive emails that are invalid.
it's my update command
Dim com As New SqlCommand("Update Newsletter_Emails Set Active='False' Where (Email IN (" & Error_Email & "))", con)
also i have tested some option like ... Where (Email IN " & Error_Email & ")", con)
and ... Where Email IN '" & Error_Email & "'", con)
but any way it has some error :
Unclosed quotation mark after the character string ''))'.
Incorrect syntax near ''))'.
any suggestion?
thanks in advance
Loading

tan hongyou4 reputationPosted May 31, 2012, 4:02 PM EDT
Dim com As New SqlCommand("Update Newsletter_Emails Set Active='False' Where Email IN (" & Error_Email & ")", con)
VulpesRank #55 · 29.2K reputationPosted Jun 1, 2012, 12:38 AM EDT
Unclosed quotation mark after the character string ''))'.
Although I'd have thought this would have been noticeable, I'd check it anyway.
Bahar Jalali165 reputationPosted Jun 2, 2012, 8:01 AM EDT
every my try don't work! why?
my last try is :
Dim mystr As String = "Update Newsletter_Emails Set Active='False' Where Email IN" & Error_Email
but don't work
error is :
Incorrect syntax near ''.
Unclosed quotation mark after the character string '''.
also i tried this one :
Dim mystr As String = "Update Newsletter_Emails Set Active='False' Where Email IN '" & Error_Email & "'"
and get this error :
VulpesRank #55 · 29.2K reputationPosted Jun 2, 2012, 9:51 AM EDT
brunda kRank #3,804 · 389 reputationPosted Jun 2, 2012, 10:21 AM EDT
In the above code Email IN '" & Error_Email & "'"
replace with
Email IN ('" & Error_Email & "')"
tan hongyou4 reputationPosted Jun 2, 2012, 4:01 PM EDT
Bahar Jalali165 reputationPosted Jun 2, 2012, 9:31 PM EDT
Anil KumarRank #367 · 6.8K reputationPosted Jun 3, 2012, 1:43 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 3, 2012, 2:30 AM EDT
However, it is still possible to do it in a composite way if Error_Email contains something like this:
Dim Error_EMail As String = "'[email protected]', '[email protected]', '[email protected]'"
The following UPDATE statement should then work:
Dim com As New SqlCommand("Update Newsletter_Emails Set Active='False' Where Email IN (" & Error_Email & ")", con)