Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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 18th, 2008, 12:58 PM
Authorized User
 
Join Date: Jun 2008
Posts: 75
Thanks: 15
Thanked 0 Times in 0 Posts
Default Populating TreeView Control using Access Database

Here is a little information that might be of value in helping solve my problem.

1). I am using the SQLDatasource object to connect to an access database. I am writing this web app to basically replace a manual my organization using concerning services we offer. What I am trying to achieve is to display an index using a TreeView Control to categorize the various services we offer alphabetically. First I want to show a list of nodes from A to Z. When the use clicks the plus sign by the A I want a dropdown list of all the services that begin with A to display. Like wise if the user clicks Z I want all the services to display that begin with Z. Then once the list of services for the corresponding alphabet are displayed I want the user to be able to click the service and then I will display a text box containing detailed information about the service.



Here is my dilemma. I run my web app and my program gives me an error 'System.Data.OleDb.OleDbConnection' cannot be converted to 'String'. Here is the code where the error happens.

Dim mySource As SqlDataSource = New SqlDataSource(conn, "GetIndexes")

a.) conn is my connection string in my web.config file. The code in my web.config file looks like this

       <appSettings>

       <add key="conn" value="Provider = Microsoft.Jet.OLEDB.4.0;Data So urce=C:\Documents
      and Settings\ronald.rex\Desktop\GuideToCityServices.md b;User ID=Admin;Password=;" />
</appSettings>

b.) GetIndexes is a Stored Procedure in my Database

Also do you see any problems with the code block below, in particular the line.
Dim result As IEnumerable = mySource.Select(DataSourceSelectArguments.Empty)

I was making changes to my code last night I received an error saying that “The Provider does not recognize Argument” and according to the compiler the problem was with Ienumerable.




Public Shared Function GetIndexes() As CategoryList

        Dim categories As New CategoryList
        Dim conn As OleDbConnection = New OleDbConnection System.Configuration.ConfigurationManager.AppSetti ngs("conn"))
        'Dim connStr As String = ConfigurationManager.ConnectionStrings("conn").Con nectionString
        Dim mySource As SqlDataSource = New SqlDataSource(conn, "GetIndexes")
        mySource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
        Dim result As IEnumerable = mySource.Select(DataSourceSelectArguments.Empty)

        Dim row As DataRowView
        For Each row In result

            categories.Add(New Category( _
                row("Id").ToString(), _
                row("Index").ToString()) _
            )
        Next
        Return categories
    End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX Treeview Control in Access Form cej2583 Access VBA 7 March 18th, 2008 02:40 PM
Updating a gridview control w/access database p3aul ASP.NET 1.0 and 1.1 Professional 0 October 2nd, 2007 06:14 PM
Urgent!! Populating Treeview server control sankar_massoft ADO.NET 3 September 24th, 2007 09:52 AM
Treeview Control pavank ASP.NET 2.0 Professional 2 May 25th, 2007 03:42 AM
Treeview Control Casanova1 VB.NET 2002/2003 Basics 0 January 8th, 2004 04:27 PM





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