Hi
I have simple problem that is causing me to get a bad headache.
here is my sinppet of code that is causing the problems:
The problem is that I am trying to get rid of the comma at the end of my sql query. Above I tried a Boolean but that didnt work as this is only putting a comma after the first select item in my list box. Thats great if I select only two items. My sql query at the moment reads:
As you can see the comma is only after the first entry. The way I had it previously I had a comma after them all but it was also after the last entry which wa no good. either. This is wrecking my head.
Thanks in advance
Will
I have simple problem that is causing me to get a bad headache.
here is my sinppet of code that is causing the problems:
VB.NET:
'***********trying to loop through list boxes Aghaaa!!!!
Dim loopzip_code As String = Nothing
Dim loopstore_code As String = Nothing
Dim i As Integer
Dim bflag As Boolean = False
'loopzip_code = "0"
'loopstore_code = "0"
For i = 0 To DDPostCode.Items.Count() - 1
If DDPostCode.Items(i).Selected Then
If bflag = False Then
loopzip_code = loopzip_code & "'" & DDPostCode.Items(i).Value & "'" & ","
bflag = True
Else
loopzip_code = loopzip_code & "'" & DDPostCode.Items(i).Value & "'"
End If
End If
The problem is that I am trying to get rid of the comma at the end of my sql query. Above I tried a Boolean but that didnt work as this is only putting a comma after the first select item in my list box. Thats great if I select only two items. My sql query at the moment reads:
VB.NET:
SQL Query=select email_address from subscriber_list where zip_code in ('45675','23456''44444''73653');
Thanks in advance
Will