Simple if-then error in onClick

D

DC Gringo

I'm getting the following error when running and if-then upon submitting a
dropdownlist value. HELP?!

Exception Details: System.FormatException: Input string was not in a correct
format.

Sub RunReport_OnClick(sender As Object, e As System.EventArgs)

If ddlCommunities.SelectedItem.Value <> 0 Then
_sqlStmt = _sqlStmt & " AND tblSurvey1.clnGUID =
'"+ddlCommunities.SelectedItem.Value+"'"
End if

BindData()
End Sub
 
6

620

I think there's a bit of a mix-up in your string concatenation syntax
between SQL and VB. See if this example works:

If ddlCommunities.SelectedItem.Value <> 0 Then
_sqlStmt &= " AND tblSurvey1.clnGUID = '" &
ddlCommunities.SelectedItem.Value & "'"
End if
 
D

DC Gringo

620, thanks for you assistance...

I am getting the same error, though.
_____
DC G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,208
Latest member
RandallLay

Latest Threads

Top