Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Obtaining Data Based Upon Multiple Selections From a ListBox...

 
Thread Tools Search this Thread
Old 10-19-2004, 02:29 PM   #1
Default Obtaining Data Based Upon Multiple Selections From a ListBox...


Asp.Net
Visual Studio 2003
SQL Server.

Hi,

I have database in Sqlserver and ListBox (Multiple Selection Mode) in my
Visual Studio Webform. I wish obtain various records from My_Store_Procedure
and fill dataset.

I used the following code and no work:

.....

Sub ChangeWhereClause(Sender As System.Object, e As System.EventArgs)
Dim strWhereClause As String = ""
For Each li in listbox1.Items
If li.Selected Then

strWhereClause &= "EmployeeID=" & li.Value & " Or " '<----------
what is wrong?

End If
Next
If strWhereClause.Length > 0 Then

strWhereClause = Left(strWhereClause, strWhereClause.Length() - 4)
strWhereClause = "WHERE " & strWhereClause
Dim strSql = "Select * " _
& "From My_Store_Procedure " & strWhereClause & " Order By
LastName"
....

In the listbox simple selection mode i used the following code:

Me.SqlSelectCommand1.Parameters("@EmployeeID").Val ue =
listbox1.SelectedItem.Value

and work fine.

In the listbox multiple selection i Tryed put:

strWhereClause &= "EmployeeID=" &
Me.SqlSelectCommand1.Parameters("@EmployeeID").val ue = li.Value
& " Or " ' <-------------------- what is wrong?

instead of:

strWhereClause &= "EmployeeID=" & li.Value & " Or "

....and no work.

In listbox multiselection mode:

How to dealing with parameters?

How to pass the parameter? "@EmployeeID".

For example: @EmployeeID instead EmployeeID

Thank you in advance,

Adis.





=?Utf-8?B?QWRpcw==?=
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wonderful data input with web reporting tool freezea Software 0 09-09-2009 05:30 AM
Address Bus and External Data Bus Confusion LoXodonte A+ Certification 1 04-18-2006 10:09 PM
Re: 7. The truth about our creator. .7 john smith DVD Video 2 07-25-2003 03:54 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46