Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 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 November 16th, 2006, 08:55 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dataset question

How do you get the contents of a dataset into a the text property of a label?



 
Old November 16th, 2006, 10:33 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can get the name of the table in the dataset but not the contents

This is the code I have right now

Code:
 Public Function GetLevel5Manager(ByRef strCriteria As String) As DataTable
        Try
            Dim strConn As String = HttpContext.Current.Session("ConnStr")
            Dim conn As New SqlConnection(strConn)
            Dim da As New SqlDataAdapter
            Dim ds As DataSet = New DataSet("Users")
            Dim cmd As SqlCommand
            Dim strCrit As String = Mid(strCriteria, 11, 7)

            conn.Open()
            cmd = conn.CreateCommand()
            With cmd
                .CommandText = "SELECT U.FullName FROM DropDownData D, Users U WHERE D.DropDownCategory = 'Level5' AND D.DisplayValue ='" & strCrit & "'and D.Misc1 = U.Associate_ID"
                .CommandType = CommandType.Text
            End With

            da = New SqlDataAdapter(cmd)
            da.Fill(ds, "Users")


            lblLevel5Manager.Text = Convert.ToString(ds.Tables.Item("Users"))




            conn.Close()

        Catch ex As Exception
            Dim sTemp As String
            sTemp = ex.Message
            lblLevel5Manager.Text = ex.Message

        End Try
    End Function





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataset Designer Question chrislepingwell ADO.NET 0 August 31st, 2006 06:27 AM
Dataset Question katsarosj ASP.NET 1.0 and 1.1 Basics 9 December 1st, 2005 07:05 AM
Dataset Question Ozymandias VB.NET 2002/2003 Basics 1 November 19th, 2003 12:00 PM





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