Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 21st, 2004, 03:59 AM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple reading from db

Hi.. im kinda new on using asp.net. need great help here.
currently im doing the listbox where by the user can multi select the information e.g(Class A). than the information from (Class A) e.g(student's mobile number) will be shown on the textbox. currently i could only display 1 number. any idea to solve my problem? thanks!

Private Sub listbox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox.SelectedIndexChanged
        Dim sql, dbcomm, dbread
        Dim dbcon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\fyr project\bin\DESIGNATION.mdb;")
        sql = "SELECT mobile_num FROM STUDENT WHERE pem_grp = '" & listbox.SelectedItem.Text & "' "
        dbcomm = New OleDbCommand(sql, dbcon)
        Dim reader As OleDbDataReader


            reader = dbcomm.ExecuteReader()

            smsTo.Text = reader("mobile_num")
            smsTo.Text += "@gSMS, "
            smsTo.Text += reader("mobile_num")

        Catch ex As Exception
            If (Not dbcon Is Nothing) Then
            End If
        End Try
    End Sub

Reply With Quote
  #2 (permalink)  
Old October 21st, 2004, 07:07 AM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts

You want to loop through though:

while reader.Read()
            smsTo.Text += reader("mobile_num")

Reply With Quote
  #3 (permalink)  
Old October 21st, 2004, 11:07 AM
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Hi dannyphw,

This is a classic ASP forum. I also noticed the same posted on .Net forum. Please don't cross post.


- Vijay G
Strive for Perfection
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
reading text between multiple delimitters using c# marker Visual Studio 2005 0 May 28th, 2007 08:10 AM
Reading multiple txt from a specified dir diegoblin Beginning VB 6 3 November 20th, 2006 06:54 PM
Reading multiple lines as a single unit ravishakya Pro Java 0 September 14th, 2006 09:08 AM
Capturing\Reading File Contents into DB with PHP aingalsbe PHP How-To 2 December 30th, 2005 09:48 AM
multiple reading from db dannyphw ASP.NET 1.0 and 1.1 Basics 2 October 23rd, 2004 08:24 AM

All times are GMT -4. The time now is 11:26 PM.

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