Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2011, 08:59 AM
Registered User
 
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()





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 06:42 AM
UNSelect Items in ListBox mmcdonal Access VBA 7 June 21st, 2007 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.