Solved

Unable to populate a DataList from a stored procedure

Posted on 2004-04-23
2
465 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

832 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