易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : asp

ASP连接MySQL数据库的方法

ASP连接MySQL数据库的方法
 
 
 
ASP等语言连接mysql数据库,可以通过安装mysql的ODBC驱动,通过配置ODBC数据源,连接并操作数据库。
mysql odbc 3.51版
下载地址:
http://dev.mysql.com/downloads/connector/odbc/3.51.html
<%
'测试读取MySql数据库的内容
strconnection="driver={mysql odbc 3.51 driver};database=weste_net;server=localhost;uid=root;password="
'无需配置dsn
set adodataconn = server.createobject("adodb.connection")
adodataconn.open strconnection
strquery = "select * from News"
set rs = adodataconn.execute(strquery)
if not rs.bof then
%>
<table>
<tr>
<td<b>序列号</b></td>
<td><b>标题</b></td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td><%=rs("News_id")%></td>
<td><%=rs("News_Title")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
else
response.write("无数据.")
end if
rs.close
adodataconn.close
set adodataconn = nothing
set rsemaildata = nothing
%>
PS:若想直接使用以 ......

ASP连接MySQL数据库的方法

ASP连接MySQL数据库的方法
 
 
 
ASP等语言连接mysql数据库,可以通过安装mysql的ODBC驱动,通过配置ODBC数据源,连接并操作数据库。
mysql odbc 3.51版
下载地址:
http://dev.mysql.com/downloads/connector/odbc/3.51.html
<%
'测试读取MySql数据库的内容
strconnection="driver={mysql odbc 3.51 driver};database=weste_net;server=localhost;uid=root;password="
'无需配置dsn
set adodataconn = server.createobject("adodb.connection")
adodataconn.open strconnection
strquery = "select * from News"
set rs = adodataconn.execute(strquery)
if not rs.bof then
%>
<table>
<tr>
<td<b>序列号</b></td>
<td><b>标题</b></td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td><%=rs("News_id")%></td>
<td><%=rs("News_Title")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
else
response.write("无数据.")
end if
rs.close
adodataconn.close
set adodataconn = nothing
set rsemaildata = nothing
%>
PS:若想直接使用以 ......

ASP中MD5加密代码

<%
Private Const BITS_TO_A_BYTE = 8
Private Const BYTES_TO_A_WORD = 4
Private Const BITS_TO_A_WORD = 32
Private m_lOnBits(30)
Private m_l2Power(30)

Private Function LShift(lValue, iShiftBits)
If iShiftBits = 0 Then
LShift = lValue
Exit Function
ElseIf iShiftBits = 31 Then
If lValue And 1 Then
LShift = &H80000000
Else
LShift = 0
End If
Exit Function
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
Err.Raise 6
End If
If (lValue And m_l2Power(31 - iShiftBits)) Then
LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000
Else
LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits))
End If
End Function
Private Function RShift(lValue, iShiftBits)
If iShiftBits = 0 Then
RShift = lValue
Exit Function
ElseIf iShiftBits = 31 Then
If lValue ......

ASP最基本的加解密函数

<%
function decrypt(dcode)
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,2))-i)
next
decrypt=texts
end function
function encrypt(ecode)
dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function
dim str
str = "neok"
Response.Write("加密前:" + str + "<br>")
Response.Write("加密后:" + encrypt(str) + "<br>")
Response.Write("解密:"+ decrypt(encrypt(str)))
%> ......

asp正则表达式判断是否是数字

'判断是否是数字(包括整数和浮点数)
function IsNumber(str)
if RegPatrn("^-?[1-9]\d*$",str) or RegPatrn("^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$",str) then
IsNumber=true
else
IsNumber=false
end if
end function
'正则表达式判断是否匹配
Function RegPatrn(patrn, strng)
RegPatrn = false
Dim regEx, Match, Matches '建立变量。
Set regEx = New RegExp '建立正则表达式。
regEx.Pattern = patrn'设置模式。
regEx.IgnoreCase = True '设置是否区分字符大小写。
regEx.Global = True '设置全局可用性。
If regEx.Test(strng) Then
RegPatrn=true
End if
End Function ......

2、纯ASP代码生成图表函数——柱图

2、纯ASP代码生成图表函数——柱图
<%
dim total(12,2)
total(1,1)=56
total(2,1)=7
total(3,1)=-7
total(4,1)=0
total(5,1)=16
total(6,1)=10
total(7,1)=14
total(8,1)=7
total(9,1)=9
total(10,1)=7
total(11,1)=11
total(12,1)=14
total(1,2)="地理"
total(2,2)="化学"
total(3,2)="历史"
total(4,2)="萝卜课"
total(5,2)="美术"
total(6,2)="体育"
total(7,2)="天文"
total(8,2)="物理"
total(9,2)="音乐"
total(10,2)="英语"
total(11,2)="政治"
total(12,2)="自然"
%>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:*         { behavior: url(#default#VML) }
o\:*         { behavior: url(#default#VML) }
.shape       { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> ......

3、纯ASP代码生成图表函数——折线图

3、纯ASP代码生成图表函数——折线图
<%dim total(7,3)
total(1,0)="中国经营报"
total(2,0)="招聘网"
total(3,0)="51Job"
total(4,0)="新民晚报"
total(5,0)="新闻晚报"
total(6,0)="南方周末"
total(7,0)="羊城晚报"
total(0,1)="#FF0000,1.5,1,2,公司1"'参数1线条的颜色,参数2线条的宽度,参数3线条的类型,参数4转折点的类型,参数5线条名称
total(1,1)=200
total(2,1)=1200
total(3,1)=900
total(4,1)=600
total(5,1)=1222
total(6,1)=413
total(7,1)=800
total(0,2)="#0000FF,1,2,3,公司2"
total(1,2)=400
total(2,2)=500
total(3,2)=1040
total(4,2)=1600
total(5,2)=1
total(6,2)=813
total(7,2)=980
total(0,3)="#004D00,1,1,3,公司3"
total(1,3)=900
total(2,3)=890
total(3,3)=1240
total(4,3)=1300
total(5,3)=722
total(6,3)=833
total(7,3)=1280
%><html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:*         { behavior: url(#default#VML) }
o\:*   ......
总记录数:617; 总页数:103; 每页6 条; 首页 上一页 [30] [31] [32] [33] 34 [35] [36] [37] [38] [39]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号