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:若想直接使用以上代码,请将全角符号“<>”替换成半角符号“<>”。
相关文档:
做项目时由于业务逻辑的需要,必须对数据表的一行或多行加入行锁,举个最简单的例子,图书借阅系统。假设 id=1 的这本书库存为 1 ,但是有 2 个人同时来借这本书,此处的逻辑为
view plaincopy to clipboardprint?
Select restnum from book where id =1 ; ......
编者注:这个class主要用于操作asp中的xmlhttp。
首先是类定义 Cls_AspHttp.asp:
<%
''=================================================================
''飞扬远程获取类(AspHttp) 1.0.1 Bate1
'' By 奔腾的心
'' 2006-04-19
''=========================================================== ......
The vs2008 and vs2010 don't support the generation LINQ to SQL business objects from a MySQL database, if you drop a MySql table to a Linq to Sql Class, it will popup a "The selected object(s) use an unsupported data provider" error.
Generation tool DBLinq
DbLinq is a LINQ to SQL data co ......
首先需要查看一下创建函数的功能是否开启:
mysql> show variables like '%func%';
+-----------------------------------------+-------+
| Variable_name   ......
asp文件搜索
<%
'*************Set newsearch=new SearchFile '声明 *************
'*************newsearch.Folder="F:+E:"'传入搜索源*************
'*************newsearch.keyword="汇编" '关键词*************
'*************newsearch.Search &nbs ......