Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 13th, 2011, 09:59 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default using listbox items for query

Hello everybody! I have an idea how to use listbox items for query, but it doesn't work. "Input string was not in a correct format."

What is wrong with this, is this good idea or not? Thank you for help!



Public Sub popisUpita_SelectedIndexChanged(sender As Object, e As EventArgs)
For Each izabraniUpit As System.Web.UI.WebControls.ListItem In popisUpita.Items
If izabraniUpit.Selected Then
izabraniUpiti.AppendFormat("{0},", izabraniUpit.Value)

End If
Next
izabraniUpiti.Remove(izabraniUpiti.Length - 1, 1)
'Remove last comma
End Sub

Using objConn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; " & "DATA SOURCE=" & Server.MapPath("HR.mdb;"))
Using objCmd As New OleDbCommand("Select [Skraćena tvrtka-naziv],", objConn)

objConn.Open()
objCmd.CommandText += " izabraniUpiti.ToString()"
' objCmd.CommandText.Remove(objCmd.CommandText.Lengt h - 1, 1)
objCmd.CommandText += " WHERE (Općina = '" & izabranaOpcina & "')"
objCmd.CommandType = CommandType.Text

Dim DR As OleDbDataReader = objCmd.ExecuteReader()
upit.DataSource = DR
upit.DataBind()
Reply With Quote
Reply


Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
moving items from one listbox to another listbox Nishapd ASP.NET 3.5 Basics 2 December 3rd, 2009 07:20 AM
Getting all listbox items Lucy_H85 C# 2005 2 December 1st, 2009 05:36 AM
moving items from one listbox to another Nishapd Classic ASP Basics 4 November 16th, 2009 05:41 PM
Moving Items up and down in a listbox Brendan Bartley Access 15 September 18th, 2007 07:42 AM
UNSelect Items in ListBox mmcdonal Access VBA 7 June 21st, 2007 09:09 AM



All times are GMT -4. The time now is 07:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.