后台代码:string sqlstr = "select * from dbo.ROOMS INNER JOIN dbo.HOTELS ON dbo.ROOMS.HOTEL_CODE=dbo.HOTELS.HOTEL_CODE";前台代码: <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" Font-Size="9pt" Width="95%"
onpageindexchanging="GridView1_PageIndexChanging" PageSize="20"
style="margin-bottom: 6px" onrowdeleting="GridView1_RowDeleting" onrowdatabound="GridView1_RowDataBound1" > <HeaderStyle CssClass="DGTitleBG" Height="30" />
<Columns>
<asp:BoundField DataField="RM_ID" HeaderText="编 号">
<ControlStyle CssClass="DGTitleBG"></ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="RM_CODE" HeaderText="房间编号">
<ControlStyle CssClass="DGTitleBG"></ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="C_RMNAME" HeaderText="所属酒店">
<ControlStyle CssClass="DGTitleBG"></ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="C_RMNAME" HeaderText="房间名称">
<ControlStyle CssClass="DGTitleBG"></ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="VALUE_RATE" HeaderText="房间价格">
<ControlStyle CssClass="DGTitleBG">
</ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="CAN_JIFENG" HeaderText="体验状态">
<ControlStyle CssClass="DGTitleBG">
</ControlStyle>
</asp:BoundField>
<asp:BoundField DataField="CAN_TRY" HeaderText="积分兑换">
<ControlStyle CssClass="DGTitleBG">
</ControlStyle>
</asp:BoundField>
<asp:CommandField HeaderText="操 作" ShowDeleteButton="True" ShowEditButton="True">
<ControlStyle Width="30px" Height="22px" CssClass="add_top"/>
<FooterStyle Height="30px" />
</asp:CommandField>
</Columns>
<PagerStyle BorderColor="#FF0066" BorderWidth="100px" />
</asp:GridView>
高手帮帮忙....
在线等...
解决方案 »
- sql 函数问题
- 如何获取Response.Write("<script>alert(parent.location.href)</script>")
- 求助:~~编辑器FreeTextBox的上传图片按钮怎么是英文的,如何转化成中文?
- 求一条SQL处理,其他历遍方法(c#)也可以,自己不会,只有问了
- 非常郁闷!按钮不灵了
- petshop 中的有些方法不太理解,觉得有些方法多余,望大家指点下
- 100分求解gb2312编码的问题 --在线等
- System.Data.SqlClient.SqlException: 用户 'NSA_001\ASPNET' 登录失败
- 解决了通过使用EXCEL.dll操作EXCEL文件的问题,格式也可以很好的控制,但是出现内存泄露的问题让我头疼不已,请高手指点迷津
- 在c/s中如何让文本框只能输入中文??
- 请教各路高手个问题,顺便散分给大家~
- 怎样在模板中加入服务器控件
System.Data.SqlClient.SqlConnection conn = new SqlConnection("connstr");
conn.Open();
string sqlstr = "select * from dbo.ROOMS INNER JOIN dbo.HOTELS ON dbo.ROOMS.HOTEL_CODE=dbo.HOTELS.HOTEL_CODE";
SqlCommand cmd = new SqlCommand(sqlstr, conn);
SqlDataAdapter sAd = new SqlDataAdapter(sqlstr, conn);
DataSet ds = new DataSet();
sAd.Fill(ds);
this.GridView1.DataSource = ds;
}
catch(Exception e)
{}