Results 1 to 3 of 3

Thread: SQL Output to Text Boxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    12

    SQL Output to Text Boxes

    How do you output the result of an SQL to an Text Box, opposed to Data Grids? My Thread below talks about my problem of implementing the SUM() function to add an column of numbers. I was just wondering how you output the results of an SQL to an Text Box, because maybe I am doing this wrong. Thanks, Working with Access and VB.Net by the way

  2. #2
    Member
    Join Date
    Dec 2005
    Posts
    63

    Re: SQL Output to Text Boxes

    It may not be the "best" way to do it (and it depends on how many textboxes/fields you have), but I have used a DataReader to do this.

    VB Code:
    1. txtName.Text = dr("Name")
    2. txtAddr.Text = dr("Address")

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: SQL Output to Text Boxes

    If it's a simple SUM() or AVG() or COUNT() or some other function that returns a single value, use ExecuteScalar. It'll return just that one value to you.

    http://msdn.microsoft.com/library/en...calartopic.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width