P
pyh_jerry
Unregistered / Unconfirmed
GUEST, unregistred user!
求助!运行后DataGrid显示不出来!跟踪发现页面代码根本没有执行!
不管是Delphi2005还是Virtual Studio 2003,按书本上说的做的,一开始很正常,后来不知道改了哪里,DataGrid就显示出来了,页上就只有几个Html的控件,怎么什么回事?我是从delphi转来的新手,各位高手帮帮忙。
下以下网页代码 <%@ ......
下以下网页代码
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false" Inherits="战队积分管理.main" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>=SHARK=战队成员表</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="dylb_frm" method="post" runat="server">
<asp:datagrid id="dylb_dg" runat="server" ShowFooter="True" AllowCustomPaging="True" CellPadding="3"
BackColor="White" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" Height="0px" Width="680px"
AutoGenerateColumns="False" AllowPaging="True" Font-Size="Larger" PageSize="30" CellSpacing="1"
GridLines="None">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
<ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
<HeaderStyle Font-Size="Larger" Font-Names="黑体" Font-Bold="True" HorizontalAlign="Left" ForeColor="#E7E7FF"
VerticalAlign="Middle" BackColor="#4A3C8C"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
<Columns>
<asp:ButtonColumn Text="选择" DataTextField="战队ID" HeaderText="游戏ID" CommandName="Select"></asp:ButtonColumn>
<asp:BoundColumn DataField="组ID" HeaderText="所属单位"></asp:BoundColumn>
<asp:BoundColumn DataField="职务" HeaderText="职务"></asp:BoundColumn>
<asp:BoundColumn DataField="昵称" HeaderText="昵称"></asp:BoundColumn>
<asp:BoundColumn DataField="分值" HeaderText="当前积分"></asp:BoundColumn>
</Columns>
<PagerStyle NextPageText="下一页&gt;" PrevPageText="&lt;上一页" HorizontalAlign="Right" ForeColor="Black"
BackColor="#C6C3C6"></PagerStyle>
</asp:datagrid></form>
<form name="dycx_frm" action="main.aspx" method="post">
<table cellSpacing="1" align="center">
<tr>
<TD style="HEIGHT: 22px">战队ID:</TD>
<td style="HEIGHT: 22px"> <input id="zdid_txt" type="text" name="zdid_txt" runat="server"></td>
<td style="HEIGHT: 22px">昵称:
</td>
<TD style="HEIGHT: 22px"><input id="name_txt" type="text" name="name_txt" runat="server"></TD>
</tr>
<tr>
<TD style="HEIGHT: 24px">QQ号码:</TD>
<td style="HEIGHT: 24px"> <input id="qq_txt" type="text" name="qq_txt" runat="server"></td>
<td style="HEIGHT: 24px">职务:
</td>
<TD style="HEIGHT: 24px"><input id="zw_txt" type="text" name="zw_txt" runat="server"></TD>
</tr>
<tr>
<TD style="HEIGHT: 25px">所在地:</TD>
<td style="HEIGHT: 25px"> <input id="szd_txt" type="text" name="szd_txt" runat="server"></td>
<td style="HEIGHT: 25px">分组:
</td>
<TD style="HEIGHT: 25px"><input id="fz_txt" type="text" name="fz_txt" runat="server"></TD>
</tr>
<tr align="center">
<TD colSpan="4">入队时间: <INPUT id="rdsj1_txt" type="text" name="rdsj1_txt" runat="server">
至 <INPUT id="rdsj2_txt" type="text" name="rdsj2_txt" runat="server"></TD>
</tr>
<tr align="center">
<TD colSpan="4"><FONT face="宋体"></FONT><INPUT id="post_btn" type="submit" value="提交" name="Submit" runat="server">
<INPUT id="clear_btn" type="reset" value="重置" name="cancel"></TD>
</tr>
</table>
</form>
</body>
</HTML>
以下是程序代码 usin......
以下是程序代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
namespace 战队积分管理
{
/// <summary>
/// main 的摘要说明。
/// </summary>
public class main : System.Web.UI.Page
{
OleDbConnection con;
OleDbCommand com;
OleDbDataAdapter dat;
protected System.Web.UI.WebControls.DataGrid dylb_dg;
protected System.Web.UI.HtmlControls.HtmlInputText qq_txt;
protected System.Web.UI.HtmlControls.HtmlInputText szd_txt;
protected System.Web.UI.HtmlControls.HtmlSelect fz_sl;
protected System.Web.UI.HtmlControls.HtmlInputText zw_txt;
protected System.Web.UI.HtmlControls.HtmlInputText name_txt;
protected System.Web.UI.HtmlControls.HtmlInputText zdid_txt;
protected System.Web.UI.HtmlControls.HtmlInputText fz_txt;
protected System.Web.UI.HtmlControls.HtmlInputText rdsj1_txt;
protected System.Web.UI.HtmlControls.HtmlInputText rdsj2_txt;
protected System.Web.UI.HtmlControls.HtmlInputButton post_btn;
DataSet ds=new DataSet();
private void Page_Load(object sender, System.EventArgs e)
{
con=new OleDbConnection("Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase Locking Mode=1;Jet OLEDBatabase Password=;Data Source=D://战队积分管理//db.mdb;Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDBon't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False");
string strcom="select c.ID,c.组ID,c.职务,c.战队ID,c.昵称,sum(j.分值) as 分值,Min(c.入队时间) as 入队时间,c.所在地 from 成员表 c, 积分记录表 j where c.ID=j.队员ID group by c.ID,c.组ID,c.职务,c.战队ID,c.昵称,c.入队时间,c.所在地";
com=new OleDbCommand(strcom,con);
com.Connection.Open();
dat=new OleDbDataAdapter();
dat.SelectCommand=com;
ds.Clear();
dat.Fill(ds);
dylb_dg.DataSource=ds;
dylb_dg.DataBind();
com.Connection.Close();
}
private void InitializeComponent()
{
this.post_btn.ServerClick += new System.EventHandler(this.post_btn_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
private void post_btn_ServerClick(object sender, System.EventArgs e)
{
string strcom="";
/*
zdid_txt.Value=zdid_txt.Value.Trim();
name_txt.Value=name_txt.Value.Trim();
qq_txt.Value=qq_txt.Value.Trim();
szd_txt.Value=szd_txt.Value.Trim();
fz_sl.Value=fz_sl.Value.Trim();
zw_txt.Value=zw_txt.Value.Trim();
rdsj1_txt.Value=rdsj1_txt.Value.Trim();
rdsj2_txt.Value=rdsj2_txt.Value.Trim();
if(zdid_txt.Value!="")
{
strcom=" and c.战队ID='"+zdid_txt.Value+"'";
}
if(name_txt.Value!="")
{
strcom=strcom+" and c.昵称='"+name_txt.Value+"'";
}
if(qq_txt.Value!="")
{
strcom=strcom+" and c.QQ号码='"+qq_txt.Value+"'";
}
if(szd_txt.Value!="")
{
strcom=strcom + " and c.所在地='"+szd_txt.Value+"'";
}
if(zw_txt.Value!="")
{
strcom=strcom + " and c.职务='"+zw_txt.Value+"'";
}
if(fz_sl.Value!="")
{
strcom=strcom + " and c.组ID='"+fz_sl.Value+"'";
}
if(rdsj1_txt.Value!="")
{
if(rdsj2_txt.Value!="")
{
strcom=strcom + " and c.入队时间 between #"+rdsj1_txt.Value+"# and #"+rdsj2_txt.Value+"#";
}
else
{
strcom=strcom + " and c.入队时间 = #"+rdsj1_txt.Value+"#";
}
}*/
string sql="select c.ID,c.组ID,c.职务,c.战队ID,c.昵称,sum(j.分值) as 分值 from 成员表 c, 积分记录表 j where 1=1 "+ strcom + " group by c.ID,c.组ID,c.职务,c.战队ID,c.昵称";
com.CommandText=sql;
com.Connection.Open();
dat.SelectCommand=com;
ds.Clear();
dat.Fill(ds);
dylb_dg.DataSource=ds;
dylb_dg.DataBind();
com.Connection.Close();
}
}
}
运行后 查看源文件 DataG......
运行后 查看源文件 DataGrid 部份是这段:
<form name="dylb_frm" method="post" action="main.aspx" id="dylb_frm">
<input type="hidden" name="__VIEWSTATE" value="dDw5ODk4NDgzMTE7dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8QDA8Ozs7Ozs7Ozs7Oz47Oz47Pj47Pj47Pj//OyQwzi62ykxrlI4oN1eiqmYF" />
</form>
不管是Delphi2005还是Virtual Studio 2003,按书本上说的做的,一开始很正常,后来不知道改了哪里,DataGrid就显示出来了,页上就只有几个Html的控件,怎么什么回事?我是从delphi转来的新手,各位高手帮帮忙。
下以下网页代码 <%@ ......
下以下网页代码
<%@ Page language="c#" Codebehind="main.aspx.cs" AutoEventWireup="false" Inherits="战队积分管理.main" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>=SHARK=战队成员表</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="dylb_frm" method="post" runat="server">
<asp:datagrid id="dylb_dg" runat="server" ShowFooter="True" AllowCustomPaging="True" CellPadding="3"
BackColor="White" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" Height="0px" Width="680px"
AutoGenerateColumns="False" AllowPaging="True" Font-Size="Larger" PageSize="30" CellSpacing="1"
GridLines="None">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
<ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
<HeaderStyle Font-Size="Larger" Font-Names="黑体" Font-Bold="True" HorizontalAlign="Left" ForeColor="#E7E7FF"
VerticalAlign="Middle" BackColor="#4A3C8C"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
<Columns>
<asp:ButtonColumn Text="选择" DataTextField="战队ID" HeaderText="游戏ID" CommandName="Select"></asp:ButtonColumn>
<asp:BoundColumn DataField="组ID" HeaderText="所属单位"></asp:BoundColumn>
<asp:BoundColumn DataField="职务" HeaderText="职务"></asp:BoundColumn>
<asp:BoundColumn DataField="昵称" HeaderText="昵称"></asp:BoundColumn>
<asp:BoundColumn DataField="分值" HeaderText="当前积分"></asp:BoundColumn>
</Columns>
<PagerStyle NextPageText="下一页&gt;" PrevPageText="&lt;上一页" HorizontalAlign="Right" ForeColor="Black"
BackColor="#C6C3C6"></PagerStyle>
</asp:datagrid></form>
<form name="dycx_frm" action="main.aspx" method="post">
<table cellSpacing="1" align="center">
<tr>
<TD style="HEIGHT: 22px">战队ID:</TD>
<td style="HEIGHT: 22px"> <input id="zdid_txt" type="text" name="zdid_txt" runat="server"></td>
<td style="HEIGHT: 22px">昵称:
</td>
<TD style="HEIGHT: 22px"><input id="name_txt" type="text" name="name_txt" runat="server"></TD>
</tr>
<tr>
<TD style="HEIGHT: 24px">QQ号码:</TD>
<td style="HEIGHT: 24px"> <input id="qq_txt" type="text" name="qq_txt" runat="server"></td>
<td style="HEIGHT: 24px">职务:
</td>
<TD style="HEIGHT: 24px"><input id="zw_txt" type="text" name="zw_txt" runat="server"></TD>
</tr>
<tr>
<TD style="HEIGHT: 25px">所在地:</TD>
<td style="HEIGHT: 25px"> <input id="szd_txt" type="text" name="szd_txt" runat="server"></td>
<td style="HEIGHT: 25px">分组:
</td>
<TD style="HEIGHT: 25px"><input id="fz_txt" type="text" name="fz_txt" runat="server"></TD>
</tr>
<tr align="center">
<TD colSpan="4">入队时间: <INPUT id="rdsj1_txt" type="text" name="rdsj1_txt" runat="server">
至 <INPUT id="rdsj2_txt" type="text" name="rdsj2_txt" runat="server"></TD>
</tr>
<tr align="center">
<TD colSpan="4"><FONT face="宋体"></FONT><INPUT id="post_btn" type="submit" value="提交" name="Submit" runat="server">
<INPUT id="clear_btn" type="reset" value="重置" name="cancel"></TD>
</tr>
</table>
</form>
</body>
</HTML>
以下是程序代码 usin......
以下是程序代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
namespace 战队积分管理
{
/// <summary>
/// main 的摘要说明。
/// </summary>
public class main : System.Web.UI.Page
{
OleDbConnection con;
OleDbCommand com;
OleDbDataAdapter dat;
protected System.Web.UI.WebControls.DataGrid dylb_dg;
protected System.Web.UI.HtmlControls.HtmlInputText qq_txt;
protected System.Web.UI.HtmlControls.HtmlInputText szd_txt;
protected System.Web.UI.HtmlControls.HtmlSelect fz_sl;
protected System.Web.UI.HtmlControls.HtmlInputText zw_txt;
protected System.Web.UI.HtmlControls.HtmlInputText name_txt;
protected System.Web.UI.HtmlControls.HtmlInputText zdid_txt;
protected System.Web.UI.HtmlControls.HtmlInputText fz_txt;
protected System.Web.UI.HtmlControls.HtmlInputText rdsj1_txt;
protected System.Web.UI.HtmlControls.HtmlInputText rdsj2_txt;
protected System.Web.UI.HtmlControls.HtmlInputButton post_btn;
DataSet ds=new DataSet();
private void Page_Load(object sender, System.EventArgs e)
{
con=new OleDbConnection("Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase Locking Mode=1;Jet OLEDBatabase Password=;Data Source=D://战队积分管理//db.mdb;Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDBon't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False");
string strcom="select c.ID,c.组ID,c.职务,c.战队ID,c.昵称,sum(j.分值) as 分值,Min(c.入队时间) as 入队时间,c.所在地 from 成员表 c, 积分记录表 j where c.ID=j.队员ID group by c.ID,c.组ID,c.职务,c.战队ID,c.昵称,c.入队时间,c.所在地";
com=new OleDbCommand(strcom,con);
com.Connection.Open();
dat=new OleDbDataAdapter();
dat.SelectCommand=com;
ds.Clear();
dat.Fill(ds);
dylb_dg.DataSource=ds;
dylb_dg.DataBind();
com.Connection.Close();
}
private void InitializeComponent()
{
this.post_btn.ServerClick += new System.EventHandler(this.post_btn_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
private void post_btn_ServerClick(object sender, System.EventArgs e)
{
string strcom="";
/*
zdid_txt.Value=zdid_txt.Value.Trim();
name_txt.Value=name_txt.Value.Trim();
qq_txt.Value=qq_txt.Value.Trim();
szd_txt.Value=szd_txt.Value.Trim();
fz_sl.Value=fz_sl.Value.Trim();
zw_txt.Value=zw_txt.Value.Trim();
rdsj1_txt.Value=rdsj1_txt.Value.Trim();
rdsj2_txt.Value=rdsj2_txt.Value.Trim();
if(zdid_txt.Value!="")
{
strcom=" and c.战队ID='"+zdid_txt.Value+"'";
}
if(name_txt.Value!="")
{
strcom=strcom+" and c.昵称='"+name_txt.Value+"'";
}
if(qq_txt.Value!="")
{
strcom=strcom+" and c.QQ号码='"+qq_txt.Value+"'";
}
if(szd_txt.Value!="")
{
strcom=strcom + " and c.所在地='"+szd_txt.Value+"'";
}
if(zw_txt.Value!="")
{
strcom=strcom + " and c.职务='"+zw_txt.Value+"'";
}
if(fz_sl.Value!="")
{
strcom=strcom + " and c.组ID='"+fz_sl.Value+"'";
}
if(rdsj1_txt.Value!="")
{
if(rdsj2_txt.Value!="")
{
strcom=strcom + " and c.入队时间 between #"+rdsj1_txt.Value+"# and #"+rdsj2_txt.Value+"#";
}
else
{
strcom=strcom + " and c.入队时间 = #"+rdsj1_txt.Value+"#";
}
}*/
string sql="select c.ID,c.组ID,c.职务,c.战队ID,c.昵称,sum(j.分值) as 分值 from 成员表 c, 积分记录表 j where 1=1 "+ strcom + " group by c.ID,c.组ID,c.职务,c.战队ID,c.昵称";
com.CommandText=sql;
com.Connection.Open();
dat.SelectCommand=com;
ds.Clear();
dat.Fill(ds);
dylb_dg.DataSource=ds;
dylb_dg.DataBind();
com.Connection.Close();
}
}
}
运行后 查看源文件 DataG......
运行后 查看源文件 DataGrid 部份是这段:
<form name="dylb_frm" method="post" action="main.aspx" id="dylb_frm">
<input type="hidden" name="__VIEWSTATE" value="dDw5ODk4NDgzMTE7dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8QDA8Ozs7Ozs7Ozs7Oz47Oz47Pj47Pj47Pj//OyQwzi62ykxrlI4oN1eiqmYF" />
</form>