Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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 October 13th, 2006, 10:01 PM
Registered User
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataView will not DataBind with a GridView?!

I am trying to get a list of Dates and times to show up dynamically in a GridView. I couldn't figure out how to format it properly using an AccessDataSource so instead I decided to code it myself.

I've gotten it to put data from the access database into the DataTable, and I've then transferred it into a DataView. However, whenever I try to DataBind it, it doesn't seem to do anything. I've spent several hours trying to figure it out, and tracking it line by line and have come up with nothing. Am I approaching it the wrong way?

        Dim Roster As DataTable = New DataTable()

        Roster.Columns.Add(New DataColumn("Day", GetType(String)))
        Roster.Columns.Add(New DataColumn("Start", GetType(String)))
        Roster.Columns.Add(New DataColumn("Finish", GetType(String)))

        Dim getData As New OleDbCommand("SELECT Roster.Date, Roster.Start, Roster.Finish FROM UserDetail INNER JOIN Roster ON UserDetail.UserID = Roster.UserID WHERE (UserDetail.UserName)='Jason';", myConnection)
        Dim rosData As OleDbDataReader

        rosData = getData.ExecuteReader()

        Do While rosData.Read()
            Dim dRow As DataRow = Roster.NewRow()
            dRow.Item(0) = DateTime.Parse(rosData.Item(0)).DayOfWeek.ToString()
            dRow.Item(1) = DateTime.Parse(rosData.Item(1)).TimeOfDay.ToString()
            dRow.Item(2) = DateTime.Parse(rosData.Item(2)).TimeOfDay.ToString()

        Dim RosterView As DataView = New DataView(Roster)

        If Not RosterView Is Nothing Then
            RosterGrid.DataSource = RosterView
            RosterGrid.Visible = True
        End If

Similar Threads
Thread Thread Starter Forum Replies Last Post
Databind DarkForce ASP.NET 2.0 Basics 5 January 25th, 2011 12:04 PM
About the Databind() kuuy BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 November 15th, 2006 12:56 PM
Databind in TextBox kapi.goel C# 1 April 26th, 2006 05:51 AM
Gridview DataBind to DataTable not showing changes wirerider ASP.NET 2.0 Basics 1 March 4th, 2006 08:59 PM
Can't get RadioButtonlist with databind nayalksrs123 .NET Web Services 0 January 15th, 2005 06:29 AM

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