Wrox Programmer Forums
|
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 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 October 21st, 2004, 03:59 AM
Registered User
 
Join Date: Oct 2004
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

        Try

            dbcon.Open()
            reader = dbcomm.ExecuteReader()
            reader.Read()

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

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

 
Old October 21st, 2004, 07:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You want to loop through though:

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

Brian
 
Old October 21st, 2004, 11:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi dannyphw,

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

Cheers!

_________________________
- Vijay G
Strive for Perfection





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





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