Solved

Unable to populate a DataList from a stored procedure

Posted on 2004-04-23
2
464 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
Comment Utility
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
Comment Utility
It was an error in the stored procedure.
Thanks James, you win.
cheers,
dwcorwith
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now