Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Unable to populate a DataList from a stored procedure

Posted on 2004-04-23
2
Medium Priority
?
479 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 800 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 Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

916 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