Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unable to populate a DataList from a stored procedure

Posted on 2004-04-23
2
Medium Priority
?
477 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

705 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