惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threat Research - Cisco Blogs
V2EX - 技术
V2EX - 技术
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Recorded Future
Recorded Future
S
Schneier on Security
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
O
OpenAI News
W
WeLiveSecurity
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
V
Visual Studio Blog
PCI Perspectives
PCI Perspectives
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
D
DataBreaches.Net
B
Blog RSS Feed
N
News and Events Feed by Topic
N
News and Events Feed by Topic
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
腾讯CDC
Latest news
Latest news
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
V
V2EX
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
Help Net Security
Help Net Security

博客园 - 龍的傳人

再谈代码生成器,拥有自己最适合的代码生成器 javascript+css+xml 全选树(再续) 设表格细钱 javascript+css+xml 全选树(续) javascript+css+xml 全选树 白话CMMI 如何做好需求收集[来之《程序员》第2期] javascript、CSS、XML动太生成树菜单 - 龍的傳人 - 博客园 可选择也可填写的下拉框(用鼠标\键盘的上下键选择) - 龍的傳人 - 博客园 兼容firefox和IE的两级联动下拉菜单的javascript代码 HTML 图片分析 JavaScript - Import XML Document firefox与IE对javascript和CSS的区别(转) IE和Firefox在JavaScript方面的兼容性(转) javascript在中ie与firefox的区别与解决方案(转) 针对Firefox兼容性,要注意的一些问题 (转) sql2000和文本文件的写入和读取(转) [转]JS代码格式化工具(附源代码) Remote建立分析
ASP.NET2.0调用MySql的存储过程
龍的傳人 · 2006-09-21 · via 博客园 - 龍的傳人

MYSQL 5.0开始便加入了存储过程,因为它出现的时间还不是很久,现在有很多都在问,MYSQL存储过程怎么建立,下我就我所理解的建了一个.asp.net2.0下调用非常方法,SQL差不多,但也有少少差别,下面就是MYSQL一个分页的的存储过程;MYSQLlimite给我们带来很大的方便.不要写太多的代码!

DELIMITER $$;

DROP PROCEDURE IF EXISTS `mytest`.`MyPage`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `MyPage`(

tableName varchar(100),

fieldsName VARCHAR(100),

pageIndex int,

pageSize int,

sortName VARCHAR(500),

strWhere varchar(500)

)

BEGIN

DECLARE fieldlist VARCHAR(200);

if fieldsName=''||fieldsName=null THEN

   set fieldlist='*';

else

   set fieldlist=fieldsName;

end if;

if strWhere=''||strWhere=null then

     if sortName=''||sortName=null then

         set @strSQL=concat('select ',fieldlist,' from ' , tableName,' limit ',(pageindex-1)*pageSize,',',pageSize);

     else

         set @strSQL=concat('select ',fieldlist,' from ' , tableName,' order by ',sortName,' limit ',(pageindex-1)*pageSize,',',pageSize);

     end if;

else

    if sortName=''||sortName=null then

        set @strSQL=concat('select ',fieldlist,' from ' , tableName,' where ',strWhere,' limit ',(pageindex-1)*pageSize,',',pageSize);

    else

        set @strSQL=concat('select ',fieldlist,' from ' , tableName,' where ',strWhere,' order by ',sortName,' limit ',(pageindex-1)*pageSize,',',pageSize);

    end if;

end if;

PREPARE stmt1 FROM @strSQL;

EXECUTE stmt1;

DEALLOCATE PREPARE stmt1;

END$$

DELIMITER ;$$

Asp.net2.0调用方法.下次给出来…….