1、转换时间类型:

ASP中的VBscript种种用法<%=datevalue(rs("fbsj"))%>
上面的代码中rs("fbsj")从数据库存中取得的时间字段值,它是长时间类型的
使用datavalue(rs("fbsj"))进行转换!

2、取字符串中的字符操作
 一、从字符串左边取出2个字符:
1 dim stra
2 stra ="welcome"
3 stra=left(stra,2)
4 response.write(stra)
二、从字符串右边取出3个字符:
1 dim stab
2 strb="come on baby"
3 strb=right(strb,3)
4 response.write(strb)

3、删除数据:
1ASP中的VBscript种种用法<%
2ASP中的VBscript种种用法If Request("Action")="Del" Then
3ASP中的VBscript种种用法    Conn.Execute("Delete From dwzp Where did="&Request.querystring("did"))
4ASP中的VBscript种种用法    Response.Redirect "zhaopingManager.asp?cid="&request.querystring("cid")
5ASP中的VBscript种种用法    response.end
6ASP中的VBscript种种用法End If
7ASP中的VBscript种种用法%>
4、将数据库的值填充至table的做法:
ASP中的VBscript种种用法<%
ASP中的VBscript种种用法cid
=request.QueryString("cid")
ASP中的VBscript种种用法
set rs=server.CreateObject("adodb.recordset")
ASP中的VBscript种种用法strsql
="select * from dwzp where cid="&cid
ASP中的VBscript种种用法rs.open strsql,conn,
1,3
ASP中的VBscript种种用法
ASP中的VBscript种种用法%
>
ASP中的VBscript种种用法
<table width="600px" border="0" cellspacing="0" cellpadding="0">
ASP中的VBscript种种用法
<tr class="trtitle">
ASP中的VBscript种种用法
<td width="120px">
ASP中的VBscript种种用法招骋职位
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法性别要求
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法年龄要求
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法学历要求
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法工作地点
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法发布时间
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法删除
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
</tr>
ASP中的VBscript种种用法
<
ASP中的VBscript种种用法
do while not rs.eof 
ASP中的VBscript种种用法strzpzw
=rs("zpzw")
ASP中的VBscript种种用法
if len(strzpzw)>5 then
ASP中的VBscript种种用法strzpzw
=left(strzpzw,5)&"ASP中的VBscript种种用法"
ASP中的VBscript种种用法
end if
ASP中的VBscript种种用法%
>
ASP中的VBscript种种用法
<tr>
ASP中的VBscript种种用法
<td >
ASP中的VBscript种种用法
<a href="#" onClick="window.open('Editzhaopin.asp?did=<%=rs("did")%>','','width=640,height=580,scrollbars=yes')">
ASP中的VBscript种种用法
<%=strzpzw%>
ASP中的VBscript种种用法
</a>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<%=rs("xbyq")%>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<%=rs("nlyq")%>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<%=rs("xlyq")%>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<%=rs("gzdd")%>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<%=datevalue(rs("fbsj"))%>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
<td>
ASP中的VBscript种种用法
<a href="?Action=Del&did=<%=rs("did")%>&cid=<%=cid%>" OnClick="return ConfirmDel();">删除</a>
ASP中的VBscript种种用法
</td>
ASP中的VBscript种种用法
</tr>
ASP中的VBscript种种用法
<%
ASP中的VBscript种种用法rs.movenext
ASP中的VBscript种种用法
loop
ASP中的VBscript种种用法rs.close
ASP中的VBscript种种用法
ASP中的VBscript种种用法%
>
ASP中的VBscript种种用法
</table>
5.数据库链接对象(将如下代码拷至conn.asp页面中,单独的作为链接对象)
其他页面要用的时候用<!--#include file="conn.asp"-->放至页面顶部就可以调用了
 1 <%
 2 dim conn,connstr,db
 3 db="databases/syb.mdb"
 4 Set conn = Server.CreateObject("ADODB.Connection")
 5 connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
 6 conn.Open connstr
 7 sub closedb()
 8     conn.close
 9     set conn=nothing
10 end sub
11 %>
6、修改数据
 1 <!--#include file="conn.asp"-->
 2 <%
 3 did=request.querystring("did")
 4 strsql="select * from dwzp where did="&did
 5 set rs=server.CreateObject("Adodb.Recordset")
 6 rs.open strsql,conn,2,2
 7 if request.QueryString("action")="Modify" then
 8 txtzpzw=request("txtzpzw")
 9 txtzpzy=request("txtzpzy")
10 txtzyyq=request("txtzyyq")
11 txtsex=request("txtsex")
12 txtage=request("txtagestart")&"-"&request("txtageend")
13 txtxlyq=request("txtxlyq")
14 txthkdz=request("txthkdz")
15 txtgzdz=request("txtgzdz")
16 txtgznx=request("txtgznx")
17 txtyx=request("txtyx")
18 txtgzfs=request("txtgzfs")
19 txtqtyq=request("txtqtyq")
20 rs("zpzw")=txtzpzw
21 rs("zpzy")=txtzpzy
22 rs("zyyq")=txtzyyq
23 rs("xbyq")=txtsex
24 rs("nlyq")=txtage
25 rs("xlyq")=txtxlyq
26 rs("hkszd")=txthkdz
27 rs("gzdd")=txtgzdz
28 rs("gznx")=txtgznx
29 rs("yx")=txtyx
30 rs("gzfs")=txtgzfs
31 rs("qtyq")=txtqtyq
32 rs.update
33 rs.close
34 Response.write "<Script>alert('企业职位招骋修改成功!');opener.location.reload();window.close();</Script>"
35 response.end
36 end if
37 %>
38 
39 如果不是修改的话将取的数据填充table中
40 <tr>
41       <td>&nbsp;</td>
42       <td>*职业要求</td>
43       <td colspan="3"><textarea name="txtzyyq" cols="50" rows="5" id="txtzyyq"><%=rs("zyyq")%></textarea></td>
44     </tr>
45     <tr>
46       <td>&nbsp;</td>
47       <td>*性别要求</td>
48       <td width="182"><select name="txtsex" size="1" id="txtsex">
49       <option value="<%=rs("xbyq")%>" selected="selected"><%=rs("xbyq")%></option>
50         <option value="不限" >不限</option>
51         <option value=""></option>
52         <option value=""></option>
53       </select>      </td>
54       <td width="82">*年龄要求</td>
55       <td width="216"><input name="txtagestart" type="text" id="txtagestart" size="3" maxlength="2" value="<%=left(rs("nlyq"),2)%>"/>
56         至
57         <input name="txtageend" type="text" id="txtageend" size="3" maxlength="2" value="<%=right(rs("nlyq"),2)%>" /></td>
58     </tr>
59     <tr>
60       <td>&nbsp;</td>
61       <td>*学历要求</td>
62       <td><select name="txtxlyq" size="1" id="txtxlyq">
63         <option value="不限">不限</option>
64         <option value="<%=rs("xlyq")%>" selected="selected"><%=rs("xlyq")%></option>
65         <option value="高中、技校">高中、技校</option>
66         <option value="中专">中专</option>
67         <option value="大专">大专</option>
68         <option value="本科">本科</option>
69         <option value="硕士">硕士</option>
70         <option value="博士">博士</option>
71       
72       </select>      </td>
73 
74 
7、添加数据
 1ASP中的VBscript种种用法<!--#include file="conn.asp"-->
 2ASP中的VBscript种种用法<!--#include file="sybadmin/md5.asp"-->
 3ASP中的VBscript种种用法<%
 4ASP中的VBscript种种用法cid=request.QueryString("cid")
 5ASP中的VBscript种种用法txtzpzw=request("txtzpzw")
 6ASP中的VBscript种种用法txtzpzy=request("txtzpzy")
 7ASP中的VBscript种种用法txtzyyq=request("txtzyyq")
 8ASP中的VBscript种种用法txtsex=request("txtsex")
 9ASP中的VBscript种种用法txtage=request("txtagestart")&"-"&request("txtageend")
10ASP中的VBscript种种用法txtxlyq=request("txtxlyq")
11ASP中的VBscript种种用法txthkdz=request("txthkdz")
12ASP中的VBscript种种用法txtgzdz=request("txtgzdz")
13ASP中的VBscript种种用法txtgznx=request("txtgznx")
14ASP中的VBscript种种用法txtyx=request("txtyx")
15ASP中的VBscript种种用法txtgzfs=request("txtgzfs")
16ASP中的VBscript种种用法txtqtyq=request("txtqtyq")
17ASP中的VBscript种种用法set rs=server.CreateObject("adodb.recordset")
18ASP中的VBscript种种用法sqlstr="select * from dwzp"
19ASP中的VBscript种种用法rs.open sqlstr,conn,1,3
20ASP中的VBscript种种用法rs.addnew
21ASP中的VBscript种种用法rs("cid")=cid
22ASP中的VBscript种种用法rs("zpzw")=txtzpzw
23ASP中的VBscript种种用法rs("zpzy")=txtzpzy
24ASP中的VBscript种种用法rs("zyyq")=txtzyyq
25ASP中的VBscript种种用法rs("xbyq")=txtsex
26ASP中的VBscript种种用法rs("nlyq")=txtage
27ASP中的VBscript种种用法rs("xlyq")=txtxlyq
28ASP中的VBscript种种用法rs("hkszd")=txthkdz
29ASP中的VBscript种种用法rs("gzdd")=txtgzdz
30ASP中的VBscript种种用法rs("gznx")=txtgznx
31ASP中的VBscript种种用法rs("yx")=txtyx
32ASP中的VBscript种种用法rs("gzfs")=txtgzfs
33ASP中的VBscript种种用法rs("qtyq")=txtqtyq
34ASP中的VBscript种种用法rs("fbsj")=now()
35ASP中的VBscript种种用法rs.update
36ASP中的VBscript种种用法response.Write"<script>alert('招骋职位发布成功!');window.location.href('qymain.asp?cid="&rs("cid")&"')</script>"
37ASP中的VBscript种种用法%>
8、取参数的值
1ASP中的VBscript种种用法session("username")
2ASP中的VBscript种种用法request.querystring("id")
3ASP中的VBscript种种用法request("id")
4ASP中的VBscript种种用法request.form("文本框名")
5ASP中的VBscript种种用法
9、弹出窗口操作完后,如何更新主页面
1 Response.write "<Script>alert('企业职位招骋修改成功!');opener.location.reload();window.close();</Script>"
2 response.end

10、向弹出窗口传递值
1ASP中的VBscript种种用法<a href="#" onClick="window.open('Editzhaopin.asp?did=<%=rs("did")%>','','width=640,height=580,scrollbars=yes')">
2ASP中的VBscript种种用法<%=strzpzw%>
3ASP中的VBscript种种用法</a>

相关文章: