Solved

Unable to populate a DataList from a stored procedure

Posted on 2004-04-23
2
467 Views
Last Modified: 2010-05-18
Hello Experts:
This code shows a blank screen when I run it.  I am trying to populate a simple DataList from a stored procedure.  The connection string works fine as I have run this successfully with a SQL statement just not from a stored procedure.

        Try

            Dim strConnString As New MyPal.MyConstants                  'define connection string
            Dim conn As New OleDbConnection(strConnString.strLocalConn)  'setup connection
            Dim objCmd As New OleDbCommand("spListingFA", conn)          'execute a stored procedure against a connection  
            Dim DataAdapter As OleDbDataAdapter                      'open db connection see pg 141 ASP.Net Developers cookbook
            Dim ds As DataSet = New DataSet

            objCmd.CommandType = CommandType.StoredProcedure
            DataAdapter = New OleDbDataAdapter(objCmd)
            DataAdapter.Fill(ds)

            DataList1.DataSource = ds
            DataList1.DataBind()
        Catch
            'do something
        End Try


        <asp:DataList id="DataList1" runat="server">
            <ItemTemplate>
            <div style="FONT-SIZE: 10pt; COLOR: forestgreen; FONT-FAMILY: Verdana"> <%# DataBinder.Eval(Container.DataItem,"Origin") %>
            <%# DataBinder.Eval(Container.DataItem,"TripStartDate") %>    </div>
            </ItemTemplate>
      </asp:DataList></P>

Thanks,
dwcorwith
0
Comment
Question by:dwcorwith
2 Comments
 
LVL 7

Accepted Solution

by:
culshaja earned 200 total points
ID: 10916529
Have you tried to see what the error message is in the catch statement. My guess is that there is either an error in the stored rpcoedure or a premissions isuue such as the user connecting to the database in the connectionstring does not have execute rights on the stored prcoedure.

james ;-)
0
 
LVL 2

Author Comment

by:dwcorwith
ID: 10918048
It was an error in the stored procedure.
Thanks James, you win.
cheers,
dwcorwith
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question