面向过程的.NET(一工作代码)
.net in-line script 做过的一个查询页,记录一下今天TOP 20
某一会员某一天统计
会员所有天记录统计
<script runat="server">
void Page_Load(object sender, EventArgs e) {
//查询时间默认为今天
if(!Page.IsPostBack){
txtReportTime.Text = System.DateTime.Today.ToString();
bindGrid();
}
else{
//开始进行查询
if(ddlReportType.SelectedValue == "0"){//0为今天TOP20
//if(QueryControls.Visible){//首进为今天天TOP20,隐藏查询条件面板
QueryControls.Visible = false;
QueryControls02.Visible = false;
//}
}
bindGrid();
}
}
void bindGrid(){
System.Data.IDataReader dr;
dr = MyQueryMethod();
dgDotReport.DataSource = dr;
dgDotReport.DataBind();
}
void disposeGrid(){
//清掉datagrid
dgDotReport.Dispose();
dgDotReport.DataSource = "";
dgDotReport.DataBind();
}
System.Data.IDataReader MyQueryMethod() {
string connectionString = "server='(local)'; user id='sa'; password='kemin%@)9999'; database='diligencexxx'";
System.Data.IDbConnection dbConnection = new System.Data.SqlClient.SqlConnection(connectionString);
补充:asp.net教程,基础入门