代码如下:
MyCity = WRMPS.GetCookies(\"MyCity\")
set rst = conn.execute(\"select wm_id from wm_area where wm_name=\'\"defds123mycitydefds123\"\'\")
if not rst.eof then
MyCityID = rst(0)
else
MyCityID = 0
end if
rst.close
<pre id=\"best-answer-content\" class=\"reply-text mb10\">1、建索引按照二楼,三楼的方法,一般都能解决查询慢的问题。
2、建索引提升的效果也不明显的话,请用存储过程。
CREATE PROCEDURE [dbo].[Search]
@mycity
varchar(20)
AS
DECLARE @MyCityID AS smallint
IF EXISTS(select top 1 wm_id from wm_area where wm_name = @mycity)
BEGIN
select top 1 @MyCityID = wm_id from wm_area where wm_name = @mycity