易截截图软件、单文件、免安装、纯绿色、仅160KB

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:若想直接使用以上代码,请将全角符号“<>”替换成半角符号“<>”。


相关文档:

注意Mysql数据截断

Beware of MySQL Data Truncation
http://www.mysqlperformanceblog.com/2009/02/07/beware-of-mysql-data-truncation/
比如:有一个表aritcle和另一个表article_comment,关联是article的id
CREATE TABLE `article` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL,
......

像ASP一样轻松实现分页显示数据C#

 
代码如下:
<%@ Page Language="C#" Debug="true" %>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.SqlClient"%>
<Script Language="C#" runat="server">
int Record_Per_Page;//定义每页显示记录数
int nPageCount;//定义总页数
int nRecCount;//定义总 ......

mysql 慢查询分析

轉自花開的地方
mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysql启动
的时候加入一些参数。
如果在my.cnf里面修改,需增加如下几行
long_query_time = 1
log-slow-queries
=
log-queries-not-using-indexes
long_query_t ......

mysql concat,substring用法


在工作中碰到一个Mysql字段更新问题
在custom表中有一个tariffurl的值中有如下情况:
uploadfiles ariff2007031172720306698.jpg以及uploadfiles ariff2007031172720306690.jpg;uploadfiles ariff2007031172720306691.jpg形式
要更改成uploadfiles/tariff/200703/1172720306698.jpg及 uploadfiles/tariff/200703/11727 ......

MySql创建函数

首先需要查看一下创建函数的功能是否开启:
mysql> show variables like '%func%';
+-----------------------------------------+-------+
| Variable_name                          ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号