Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 18th, 2008, 12:58 PM
Authorized User
Join Date: Jun 2008
Location: , , .
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


       <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=;" />

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()) _
        Return categories
    End Function

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 11:35 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.