我的datagride中列了两个字段是一个是否公布BYTE型的叫isSend 别一个是题目VarChar型title这语句这样写有错吗
"SELECT title,case isSend when 1 then '公布'else'未公布' end FROM GB_LeaveWord  order by isSend ASC";<asp:datagrid id="DataGrid1" runat="server" AllowPaging="True" BackColor="White" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"Width="6%"VerticalAlign="Middle">
</HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateColumn>
<asp:ButtonColumn DataTextField="title" HeaderText="主题" CommandName="Select" DataTextFormatString="{0}">
<asp:BoundColumn DataField="isSend" HeaderText="公布"></asp:BoundColumn>
</Columns>

解决方案 »

  1.   

    isSend 是BYTE型﹐怎么可以給它賦直公布' '未公布'這種字符型呢
      

  2.   

    "SELECT title,case isSend when 1 then '公布' else '未公布' end transsend FROM GB_LeaveWord  order by isSend ASC";<asp:BoundColumn DataField="transsend" HeaderText="公布"></asp:BoundColumn>
      

  3.   

    "SELECT title,(case isSend when 1 then '公布'else'未公布' end) AS isSend FROM GB_LeaveWord  order by isSend ASC";
      

  4.   

    SELECT title,case  when isSend=1 then '公布' when isSend=0 then '未公布' end as a FROM GB_LeaveWord  order by isSend ASC
    在你的查询分析器里面试试。