Creating Dynamic WhereCondition

emuplains

New member
Joined
Sep 7, 2005
Messages
3
Programming Experience
1-3
I am trying to create a wherecondition where get primary key's our of the database and pass it to a report. The way I am trying to do it is as follows but I can't seem to get it working.

VB.NET:
If selected_keywords.Count > 0 Then
			'keyid = selected_keywords.ToArray()

			While row_count < selected_keywords.Count
				'MsgBox(keyid.GetValue(row_count))
			    sqlWhere = sqlWhere + " And keyword_id =" & selected_keywords.Item(row_count)
				row_count += 1
			End While
			'MsgBox(sqlWhere)

			If marketDates.SelectedItems.Count > 0 Then
				doReport(rep, dateQuery(), sqlWhere)
			Else
				doReport(rep, "", sqlWhere)
			End If
		Else
			If marketDates.SelectedItems.Count > 0 Then
				doReport(rep, dateQuery(), "")
			Else
				doReport(rep, "", "")
			End If
		End If

If anyone could help me figure out a way to do this I would be very grateful. I am trying to pass it to the method where multiple values need to be in the WhereCondition and that is where I am having problems.

Thanks in advance.
 
How would I do it if not the way I am trying then? I have been trying to figure it out with no luck. Any suggestions would be helpful!
 
Back
Top