2007年9月19日
posted @ 2007-09-19 19:38 gerdy 阅读(196) 评论(0) 编辑

reg扩展名的注册文件不能有空格,否则系统会判断错误!!!

title="<%# XPath('rate')%>"   // 千万记得别用两双引号.

 

public void test(object sender,ajaxtoolkit.ratingEventargs e)
{
    e.tag=表达式;
}

gridviewRowEventargs e //同上

e.Row.Cells[0].Attributes.Add("onmouseout","javascript代码");

xml内存读取

xmlDocument xd =new XmlDocument();
xd=XmlDSrating.GetXmlDocument();
string path="路径";
xmlNodeList xnl;
xnl =xd.SelectNodes(path);

    public void allchecked(object sender, Eventargs e)
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            ((CheckBox)GridView1.Rows[i].FindControl("CheckBox1")).Checked = true;//两个括号
        }   //checkbox的属性 autopostback 得设置为true  要不,不会触发服务器.
    }
//输出gridview上的值到excel;
        Response.Clear();
        Response.Buffer = true;
        Response.AppendHeader("Content_disposition", "attachment;filename=FileName.xls");
        Response.ContentEncoding = System.Text.Encoding.UTF7;//不能使用gb2312,出乱码;
        Response.ContentType = "application/ms_excel";
        StreamWriter sw = new StreamWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        this.GridView1.RenderControl(htw);
        Response.Output.Write(sw.ToString());
        Response.Flush();
        Response.End();

做gridview的自定义翻页按钮时,必须使用手动绑定..
public void GridView1_PageIndexChanging(object sender,gridviewPageEventargs e)
{
   gridview1.pageIndex=e.NewPageIndex;//前一页就是pageindex等于pageindex-1,最后一页就是pageindex=pagecount-1
   GridViewDataBind();
}
存储过程在OleDb里的指令是CommandType.Text,在SqlCommand里是COmmandType.StoreProcedure;
SqlCommand scmd=new sqlcommand();
cmd.CommandText="ReadCustomerAndOrders";//存储过程
SqlDataReader rd=scmd.ExecuteReader();
if(rd.read())
//...read result set
reader.NextResult();

private static void ReadOrderData(string connectionString)
{
    string queryString =
        "SELECT OrderID, CustomerID FROM dbo.Orders;";
    using (SqlConnection connection = new SqlConnection(    //这时候用using..
               connectionString))
    {
        SqlCommand command = new SqlCommand(
            queryString, connection);
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();
        try
        {
            while (reader.Read())
            {
                Console.WriteLine(String.Format("{0}, {1}",
                    reader[0], reader[1]));
            }
        }
        finally
        {
            // Always call Close when done reading.
            reader.Close();
        }
    }
}

posted @ 2007-09-19 19:36 gerdy 阅读(31) 评论(0) 编辑
select ziduan1+","+ziduan2 "newziduan from table1 where ziduan3 =canshu 改变标题方法: 1.select ziduan1 "newziduan" from table1; 2.select 新字段=ziduan from table1; 删除重复行: select distinct* from table //使用关键字:distinct,默认为all; 返回限制行: select top 2* from table ; select top 20 percent from table; select ziduan1 from table1 as 别名 where所使用的运算符: >,>=,=,<,<=,<>,!>,!<,between...and...,not between...and..., in(项1,项2...),not in(项1,项2...)//判断表达式是否在列表中的指定项; like,not like,is null,not is null,not,and,or; like的通配字符: %:匹配任意英文字符,中文字符为%%; _:匹配对象为单个任意字符,常用来限制表达式的字符长度; []:指定一个字符,字符串或范围,要求匹配其中的任意一个; [^]:与[]相反; order by: desc降序,asc升序; 聚合函数: AVG([ALL|DISTINCT]expression) 计算平均值 MIN(expression) 计算最小值 MAX(expression) 计算最大值 SUM([ALL|DISTINCT] expression) 总和 COUNT([ALL|DISTINCT] expression) select into 产生的表必须是数据库中不存在的; 联合查询: select语句1 UNION(select语句2 UNION select语句3); 连接查询 //待补充 case语句 case ziduan when 0 then "no" when 1 then "yes" end update语句://更新同时还清空null; 单行更新: update table1 set ziduan1=1,ziduan2=2 where id =1; 多行更新: update table1 set ziduan1="new" where type="first"; insert 语句: insert table1 values("1","2","3");//按原先的顺序; insert table1(conlumn1,conlumn2) values("1","2");//插入到指定的列; insert table1 select语句//将select查询结果插入到table1中; delete from table1 where id=1;//删除 建视图: create view 视图名[列名] as select语句 //列名可省略 drop view 视图名 create table table1(ziduan1 int,ziduan2 char(40),ziduan3 numeric(20,5)) //建表语句,其中numeric表示整数位为20,小数点位为5位的数 datetime //表示从1753年1月1日到该时间的毫秒总和 自增长ID insert into table1(column1,column2,column3) values("1","2","3") select @@IDENTITY AS"自增长ID"
posted @ 2007-09-19 19:32 gerdy 阅读(161) 评论(0) 编辑

公告