I've got a stored procedure with the following criteria:
WHERE (Transaction_tbl.dtime BETWEEN @fromDate AND @toDate)
I've got a ListBox which populates the
AND (Location_tbl.Locid IN (@locations))@locations
parameter (an integer), and two DateTimePicker controls for the @fromDate
and @toDate.
I took my listbox value like this:
cnt = LSTlocations.SelectedItems.Count
If cnt > 0 Then
For i = 0 To cnt - 1
Dim locationanme As String = LSTlocations.SelectedItems(i).ToString
locid = RecordID("Locid", "Location_tbl", "LocName", locationanme)
list.Add(locid)
Next
End If
i want to pass this list item value to my stored procedure...how i can do this?
cmd23.Parameters.Add("@startDate", SqlDbType.NVarChar, 50, ParameterDirection.Input).Value= startdate
cmd23.Parameters.Add("@endDate", SqlDbType.NVarChar, 50, ParameterDirection.Input).Value = enddate
cmd23.Parameters.Add("@locations", SqlDbType.Int) ' <= ???
How can this code be modified to pass several integer identifiers as the @locations parameter so that I may select several items in my listbox?