创建你的第一个ZeroASP程序。
1.6.8版本核心基础通用类等。
1.6.8版本具备多种数据库的数据解决方案。
1.6.8版本包括GET,POST,数据流等等客户端数据。
1.6.8版本支持原生表单,AJAX和Flash组件上传。
1.6.8版本具备多种时间处理方法。
1.6.8版本支持多种加密解密解决方案。
1.6.8版本不仅适用于上传支持,还适用于远程请求支持。
1.6.8版本API请求核心功能。
1.6.8版本读写JSON数据,减少手动拼接带来的错误。
1.6.8版本读取XML数据和生成XML数据等方法。
1.6.8版本文件夹和文件操作的增删查改方法。
1.6.8版本方便开发者整合自己的功能方法。
1.6.8版本符合经典ASP3.0编程为基础的MVC。
1.6.8版本生成二维码,保存二维码,二维码图片转换。
1.6.8版本采用CDO组件发送,支持SSL协议。
1.7.0版本采用Excel组件导入导出,支持标准格式。
数据操作模块,作为ZeroASP的主要数据绑定来源,具备较多的数据解决方案,致力于方便各水平段的开发人员,你的数据会轻松地拥有丰富友好的操作体验。你可以免费将该模块使用于任何个人项目。但是不能去除模块信息。官方QQ群:199951855。
1.数据库连接;
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% 'Access Dim Conn '("数据库地址","数据库密码") Set Conn = Zasp.DB.Access("./data/ZeroASP.mdb","") 'MsSQL Dim Conn '("数据库名称","数据库地址","数据库账号","数据库密码","数据库端口号") Set Conn = Zasp.DB.MsSQL("ZeroASP","(local)","ZeroASP","123456","1433") 'SQLite Dim Conn '("数据库地址") Set Conn = Zasp.DB.SQLite("./data/ZeroASP.db") 'MySQL,默认驱动为ODBC 5.3.X For 32位,支持5.X For 32/64位版本数据库 Dim Conn '("数据库名称","数据库地址","数据库账号","数据库密码","数据库端口号") Set Conn = Zasp.DB.MySQL("ZeroASP","localhost","ZeroASP","123456","3306") %>
2.查询SQL语句;
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Rs Set Rs = Zasp.DB.Query(Conn,"Select * From [DB]") '参数1为对象,参数2为SQL语句 Zasp.Echo(Rs("Title")) '输出 %>
3.查询SQL语句(无分页);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Rs Set Rs = Zasp.DB.Query(Conn,"Select * From [DB]") '参数1为对象,参数2为SQL语句 Do While Not Rs.Eof Zasp.Echo(Rs("Title") & "
") '输出 Rs.MoveNext Loop %>
4.MySQL分页语句(MySQL分页);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Rs Set Rs = Zasp.DB.Query(Conn,"Select * From `DB` Limit 0,10") '参数1为对象,参数2为SQL语句 Do While Not Rs.Eof Zasp.Echo(Rs("Title") & "
") '输出 Rs.MoveNext Loop %>
5.查询SQL语句(Rs对象方法,支持分页);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Rs Set Rs = Zasp.DB.Rs(Conn,"Select * From [DB]",1,1) '参数1为对象,参数2为SQL语句,参数3为游标类型,参数4为锁定类型 Do While Not Rs.Eof Zasp.Echo(Rs("Title") & "
") '输出 Rs.MoveNext Loop Set Rs = Nothing %>
6.查询SQL语句(数组存储带分页);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Topsum,Limit,Pager,URL,Rs,Res,SkipStart,SkipEnd,I '预处理参数:Topsum,Limit,Pager,URL Topsum = Zasp.DB.Load(1) '输出总条数,URL参数为top Limit = Zasp.DB.Load(2) '每页记录数,URL参数为limit Pager = Zasp.DB.Load(3) '当前页,URL参数为page URL = Zasp.DB.Load(4) 'URL地址,page参数需要在URL最后 Set Rs = Zasp.DB.Query(Conn,"Select Top " & Topsum & " * From [DB]") If Not Rs.Eof Then Res = Rs.GetRows() Set Rs = Nothing SkipStart = Zasp.DB.List(Res,1) '当前页数据开始位置 SkipEnd = Zasp.DB.List(Res,2) '当前页数据结束位置 '以下为需要显示的内容 For I = SkipStart To SkipEnd Zasp.Echo(Res(0,I) & "
") '输出 Next '显示分页 Call Zasp.DB.Page(Zasp.DB.List(Res,3),URL) '分页显示样式 Set Rs = Nothing Else Set Rs = Nothing End If %>
7.执行SQL语句;
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Call Zasp.DB.Exe(Conn,"Insert Into [DB] (Id,Title)Values('1','ZeroASP数据写入')") %>
8.执行SQL语句并返回影响行数;
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Line Line = Zasp.DB.ExeRows(Conn,"Insert Into [DB] (Id,Title)Values('1','ZeroASP数据写入')") Zasp.Echo("" & Line & "行受到影响") Line = 0 '清空返回行数 %>
9.执行SQL语句-添加数据(参数化),AQ为精确,FQ为模糊(使用MySQL数据库则含中文字段内容需要使用Zasp.DB.MySQLEncode方法转换);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Id,Explain,Data Id = Zasp.Base.RndN(10000000,99999999) Explain = "文本内容" Data = Zasp.DB.Parameters(Zasp.DB.Parameter(Id) & Zasp.DB.Parameter(Explain)) Call Zasp.DB.Command(1,Conn,"Insert Into [DB] (Id,Explain)Values(?,?)",Data,"AQ,AQ") %>
10.执行SQL语句-删除数据(参数化),AQ为精确,FQ为模糊(使用MySQL数据库则含中文字段内容需要使用Zasp.DB.MySQLEncode方法转换);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Id,Explain,Data Id = Zasp.Base.RndN(10000000,99999999) Explain = "文本内容" Data = Zasp.DB.Parameters(Zasp.DB.Parameter(Id) & Zasp.DB.Parameter(Explain)) Call Zasp.DB.Command(2,Conn,"Delete * From [DB] Where Id=? And Explain=?",Data,"AQ,AQ") %>
11.执行SQL语句-查询数据(参数化),AQ为精确,FQ为模糊(使用MySQL数据库则含中文字段内容需要使用Zasp.DB.MySQLDecode方法转换);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Id,Explain,Data,Rs Id = Zasp.Base.RndN(10000000,99999999) Explain = "文本内容" Data = Zasp.DB.Parameters(Zasp.DB.Parameter(Id) & Zasp.DB.Parameter(Explain)) Set Rs = Zasp.DB.Command(3,Conn,"Select * From [DB] Where Id=? And Explain=?",Data,"AQ,AQ") Zasp.Echo(Rs("Id")) %>
12.执行SQL语句-修改数据(参数化),AQ为精确,FQ为模糊(使用MySQL数据库则含中文字段内容需要使用Zasp.DB.MySQLEncode方法转换);
<!--#include file="./ZeroASP/ZeroASP.asp"--> <% Dim Id,Explain,Explain_New,Data Id = Zasp.Base.RndN(10000000,99999999) Explain = "文本内容" Explain_New = "新文本内容" Data = Zasp.DB.Parameters(Zasp.DB.Parameter(Explain_New) & Zasp.DB.Parameter(Id) & Zasp.DB.Parameter(Explain)) Call Zasp.DB.Command(4,Conn,"Update [DB] Set Explain=? Where Id=? And Explain=?",Data,"AQ,AQ,AQ") %>