DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: display problem

  1. #1
    Join Date
    Nov 2006
    Posts
    8

    Smile display problem

    i was trying to display the data into an label but i fail, the label only display "FALSE", i dun know why. can somebody told me what wrong with my code? thanks

    this is my code:

    Dim myConnection As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DayMenu.mdf;Integrated Security=True;User Instance=True")
    Dim myCommand As SqlCommand = New SqlCommand("select resname, tmenu, price, date FROM menu where resname = 'sakura'", myConnection)

    myConnection.Open()


    Dim dr As SqlDataReader = myCommand.ExecuteReader()
    If reslist.SelectedValue = ListItem.FromString("sakura").ToString Then
    menulabel.Text = dr.Read
    End If
    myConnection.Close()

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    If you look at the documentation of the DataReader's Read method (http://msdn2.microsoft.com/en-us/lib...ader.read.aspx ; also available by highlighting the word "Read" in your code and pressing F1), you'll see that it returns a Boolean. That's why you're getting the word "False" in your label.

    For information on how to use a SqlDataReader, please see this tutorial: http://samples.gotdotnet.com/quickst...ldtreader.aspx
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Problem getting XML to properly display in HTML
    By matthewst in forum VB Classic
    Replies: 6
    Last Post: 11-14-2006, 07:31 AM
  2. Replies: 1
    Last Post: 11-09-2006, 07:41 AM
  3. login problem
    By dbrook007 in forum ASP.NET
    Replies: 0
    Last Post: 11-06-2006, 04:54 AM
  4. datagrid problem - wont refresh grid
    By Steve Ash in forum VB Classic
    Replies: 5
    Last Post: 04-24-2001, 06:51 PM
  5. Replies: 1
    Last Post: 05-29-2000, 11:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links