小知识

sql —————————— in()匹配多个
s=s.substring(1)去掉第一个字符
s=s.substring(0,s.Length-1)去掉最后一个


<%#Convert.ToSingle(Eval("original_price")).ToString("N") %></span>

<%#Convert.ToSingle(Eval("discount_price")).ToString("G0") %>格式化数据(转化为钱)


页面绑定方法<%=方法%>

dt.rows.count()统计行


getElementById() 方法
getElementById() 方法返回带有指定 ID 的元素引用:

getElementsByTagName() 方法
getElementsByTagName() 返回带有指定标签名的所有元素

如果您希望查找带有相同类名的所有 HTML 元素,请使用这个方法:
document.getElementsByClassName("intro");
getElementsByClassName() 在 Internet Explorer 5,6,7,8 中无效。


具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr()


<img src='../images/cart.gif' width='16px' onclick='CartComp("3915","1")' />

通过list(),list<T>泛型集合存数据以后通过ajax返回到前台。

数据有长度,集合没有

用foreach可以控制行数吗

定义局部变量记录行数,每次遍历+1。
int rows=1; list.count()

foreach(...)
{
.......
i++;
}



查询某一列为空时,注意NULL大写

select * from dbo.CompanyConnectionRemarks where approve_by is NULL and approve_date is NULL

更新一张表的字段到另一张表

update Item set cost=b.avg_cost from Item,(select MAX(avg_cost) as avg_cost,item_id from Stock group by item_id) b
where item.item_id=b.item_id

update Item set cost=t.avg_cost from Item i left join (
select item_id ,MAX(avg_cost) as avg_cost from Stock group by item_id) t
on i.item_id=t.item_id

距今7天以内的公司

select sales1 as from_sales from comp_assign_log where log_id in(
select max(log_id) from comp_assign_log group by comp_id)

select * from company where datediff(d,date_create,getdate()) <=7

前两家公司

select top 2 * from company

原文地址:https://www.cnblogs.com/suan1717/p/6229526.html