Totaaly confused newbie - please be kind
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Totaaly confused newbie - please be kind

  1. #1
    Join Date
    Feb 2011
    Location
    Wyckoff, New Jersey USA
    Posts
    2

    Totaaly confused newbie - please be kind

    I am attempting to show or not show some text on a web page based upon a row count in and MSSQL table. The SELECT statment returns some value where one column contains "DISPLAY" or not. This id the number of rows containing "DISPLAY" are zero I DO NOT wish to display the content.

    SO what I cam up with is -

    <form>
    <asp:SqlDataSource id="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:xyzDB %>" SelectCommand="SELECT COUNT(xEmerStatus) FROM xyzTABLE WHERE xEmerStatus = 'DISPLAY'">
    </asp:SqlDataSource>

    <aspataList id="DataList5" runat="server" DataSourceID="SqlDataSource5">
    <ItemTemplate>
    <asp:Label id="Column1Label" runat="server" Text='<%# Eval("Column1") %>' />
    </ItemTemplate>
    </aspataList>

    <%
    If DataBinder.Eval(Container.DataItem,"Column1") = 0 Then
    %>
    display code here
    <%
    End If
    %>

    </form>

    Thus the question is how can I change the returned value to an integer and "test" is againt the zero ?

    MANY THANKS for your assiatance.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: Totaaly confused newbie - please be kind

    First, determine the value that actually exists in the statement "DataBinder.Eval(Container.DataItem,"Column1")"

    I doubt that it returns 0. Might be True/False even
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2011
    Location
    Wyckoff, New Jersey USA
    Posts
    2

    Re: Totaaly confused newbie - please be kind

    Well I know the SELECT returns a zero (0).Not sure how to show what this code is returning however.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: Totaaly confused newbie - please be kind

    In your WHERE SQL Statement. NOT = 0 (Might be FALSE)

    That will return the TRUE ones
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center