ASP-Command-SQL格式

conn.open constr
Set c=Server.CreateObject("ADODB.Command")
With c
Set .ActiveConnection = conn
.CommandType = 1
.CommandText = "Select -- from -- where --=?"
.Parameters.Append .CreateParameter("@--",200,1,20,--)
set rs=.Execute()
End With
Set c.ActiveConnection = Nothing
set c=nothing
If Not rs.eof Then
--
End If
rs.close
conn.close

ASP连接数据库SQLServer

Set conn=Server.CreateObject("adodb.connection")
Set conn1=Server.CreateObject("adodb.connection")
Set rs=Server.CreateObject("adodb.Recordset")
Set cmd=Server.CreateObject("adodb.Command")

db_host="127.0.0.1"
db_name="mazey_name"
db_user="mazey_user"
db_pass="mazey_password"

constr="provider=sqloledb;initial catalog=" & db_name
constr=constr & "; data source=" & db_host
constr=constr & ";user id=" & db_user
constr=constr & ";password=" & db_pass

conn.connectionstring=constr
conn1.connectionstring=constr

CSS图片居中,多余隐藏

/*外层DIV*/

div {position: relative;overflow:hidden;width: 显示宽度px;}

/*left=50%刚好在中间,margin-left=往前移动图片一半,这是图片就是居中了*/

img {border:none;width: 图片宽度px;position:absolute;top:0;left:50%;margin-left: -图片宽度一半px;}

实测margin-left:-?px;需要调试。

ASP-Dictionary对象-基础用法

1、存在

dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "c", "China"
d.Add "i", "Italy"
if d.Exists("c")= true then
Response.Write("键存在。")
else
Response.Write("键不存在。")
end if
set d=nothing

2、遍历值

a=d.Items
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

3、遍历主键

a=d.Keys
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

4、返回值

d.Add "c", "China"
d.Add "i", "Italy"
Response.Write("项目 i 的值是:" & d.item("i"))

5、修改主键

d.Add "c", "China"
d.Add "i", "Italy"
d.Key("i") = "it"
Response.Write("键 i 已设置为 it,其值是:" & d.Item("it"))

6、返回数量

d.Count

7、删除

DictionaryObject.Remove(key)
DictionaryObject.RemoveAll

MySQL存储过程-通过数据库里已存在的IP查询城市

CREATE DEFINER=`mazey`@`%` PROCEDURE `sp_find_city_by_ip`(IN `in_visitor_ip` varchar(20),OUT `out_visitor_city` varchar(100))
BEGIN
select visitor_city into out_visitor_city
from record_visitor
where visitor_ip = in_visitor_ip
and timestampdiff(hour,visitor_time,now())<72
limit 1;
if out_visitor_city is null or out_visitor_city = '' THEN
set out_visitor_city=0;
end if;
END

#测试:

call sp_find_city_by_ip('64.74.215.1',@result);
select @result;

HTML/CSS/JS初始化

CSS
<link type="text/css" href="http://www.mazey.net/css/mazey-base.css" rel="stylesheet" />

jQuery
2.1.1
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/jquery/jquery-2.1.1.min.js"></script>

Layer
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/layer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/mazey-layer.js"></script>

Bootstrap
<link type="text/css" href="http://www.mazey.net/config/frame/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="http://www.mazey.net/config/frame/bootstrap/js/bootstrap.min.js"></script>