温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:BugTrack免安装英文原版2.4.8
当前文件:
XTXHGRGZAXU57/ajax2.aspx[1K,2009-6-12 12:00:16],打开代码结构图
XTXHGRGZAXU57/ajax2.aspx[1K,2009-6-12 12:00:16],打开代码结构图1<%@ Page language="C#"%> 2
<!-- #include file = "inc.aspx" --> 3
4
<script runat="server"> 5
6
DbUtil dbutil; 7
Security security; 8
9
/////////////////////////////////////////////////////////////////////// 10
void Page_Load(Object sender, EventArgs e) 11
{ 12
13
Util.do_not_cache(Response); 14
dbutil = new DbUtil(); 15
security = new Security(); 16
security.check_security(dbutil, HttpContext.Current, Security.ANY_USER_OK); 17
18
// will this be too slow? 19
20
// we could index on bg_short_desc and then do '$str%' rather than '%$str%' 21
22
try 23
{ 24
string sql = @"select distinct top 10 bg_short_desc from bugs 25
where bg_short_desc like '%$str%' 26
order by 1"; 27
28
// if you don't use permissions, comment out this line for speed? 29
sql = Util.alter_sql_per_project_permissions(sql, security.this_usid); 30
31
string text = Request["q"]; 32
sql = sql.Replace("$str",text.Replace("'","''")); 33
34
DataSet ds = dbutil.get_dataset(sql); 35
36
37
if (ds.Tables[0].Rows.Count > 0) 38
{ 39
Response.Write ("<select id='suggest_select' class='suggest_select' size=6 "); 40
Response.Write (" onclick='select_suggestion(this)' onkeydown='return suggest_sel_onkeydown(this, event)'>"); 41
foreach (DataRow dr in ds.Tables[0].Rows) 42
{ 43
Response.Write("<option>"); 44
Response.Write(dr[0]); 45
Response.Write("</option>"); 46
} 47
Response.Write("</select>"); 48
} 49
else 50
{ 51
Response.Write(""); 52
} 53
} 54
catch(Exception) 55
{ 56
Response.Write(""); 57
} 58
} 59
60
61
</script> 62
63







}
