empty gridview although the sqldatasource has values

前端 未结 2 666
孤城傲影
孤城傲影 2021-01-06 04:00

I have really weird situation. I\'ve created new aspx page, and without using ANY custom logic objects (everything created with visual studios wizards) tried to create grid

相关标签:
2条回答
  • 2021-01-06 04:39

    From your recent comments it looks as though SQL Profiler isn't showing any activity when the SelectCommand is issued from the SqlDataSource. This could be due to the fact that ConvertEmptyStringToNull is set to true by default on Parameters contained in the SelectParameters collection. Also, by default, the CancelSelectOnNullParameter on the SqlDataSource is set to true. This means that your 'val2' parameter is probably passing a NULL value, which in turn cancels the data retrieval operation. This is why you don't see any activity within SQL Profiler.

    Try setting CancelSelectOnNullParameter to false on the SqlDataSource.

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="myStoredProcedure" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="False"> </asp:SqlDataSource>

    0 讨论(0)
  • 2021-01-06 04:49

    I haven't see assignment of parameters(val1, val2), so default launch will assign default for string and int and pass to SQL server.

    Try SQL Server Profiler to see if you execute selection with REAL parameters

    0 讨论(0)
提交回复
热议问题