English 中文(简体)
安装App储存程序后继器 净额
原标题:Repeater binding with stored procedure in Asp.Net

我有一个存储程序<代码>SP1,该程序正在退回所设定的结果。

select column1 [Col(1)] from table1

我在此重复协会的网页:

<asp:Repeater ID="Repeater1" runat="server">
   <ItemTemplate>
      <tr>
         <td>
            <%# Eval("Col(1)")%>                                    
         </td>                                
      </tr>
   </ItemTemplate>                        
</asp:Repeater>

但是,“<%# Eval(“Col(1)”) %>,我正在发现一个错误:

“催化:系统”。 工作不允许指数化准入”

原因非常清楚,Col(1)是疼痛。 自2006年以来 我可以改变所储存的程序,以便我能如何用正文处理这种情况?

感谢。

问题回答

使用<代码>[ 第一个项目(栏目)的指数值为0。

<%# Eval("[0]") %>

Or

<%# DataBinder.Eval(Container.DataItem, "[0]")%>

这样做。

<asp:Repeater ID="Repeater1" runat="server">
   <ItemTemplate>
      <tr>
        <td>
           <%# DataBinder.Eval(Container.DataItem, "Column_Name") %>
        </td>   
       </tr>
    </ItemTemplate>                        
 </asp:Repeater>

直接提到储存程序中所用的哥伦名称。

当时的情况

<%# eval("Column_Name") %>




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签