大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> ASP编程常见问题 (转)

ASP编程常见问题 (转)

时间: 2021-07-31 作者:daque

根源:www.yesky.com1. 没辙精确运转asp 当咱们创造了一个asp文献,而且适合语法时,经过欣赏器输出以次地方,或经过资源处置器翻开欣赏: c:\inetpub\wwwroot\a.asp 将展示没辙运转的缺点,并提醒权力不对或文献没辙考察,因为是,asp文献开始诉求站点是完备“实行(剧本)”属性的;而后诉求依照url方法输出地方,而不是dos方法,以是,请矫正这两个缺点。 2. 步调挪动场所后,没辙考察数据库 这种缺点开始在odbc,即使odbc数据源树立精确,那么须要提防asp中翻开数据库的吩咐:conn.open 的参数能否精确。即使精确,则须要提防能否运用了global.asa文献,该文献是asp贯穿数据库的摆设文献,该文献实质如次: <script language="vbscript" runat="server"> 'you can add special event handlers in this file that will get run automatically when special active server pages events 'occur. to create these handlers, just create a subroutine with a namefrom the list below that corresponds to the event 'you want to use. for example, to create an event handler for session_onstart, you would put the following code into this 'file (without the comments): 'eventname description 'session_onstart runs the first time a user runs any page in your application 'session_onend runs when a user's session times out or quits your application 'application_onstart runs once when the first page of your applicationis run for the first time by any user 'application_onend runs once when the web server shuts down </script> <script language=vbscript runat=server> sub session_onstart '==visual interdev generated - dataconnection startspan== '--project data connection session("customers_connectionstring")="driver={sql server};server=(local);uid=sa;pwd=;app=microsoft(r)developer studio;wsid=gregleak;database=customers" session("customers_connectiontimeout") = 15 session("customers_commandtimeout") = 30 session("customers_runtimeusername") = "sa" session("customers_runtimepassword") = "" '==visual interdev generated - dataconnection endspan== end sub </script> 要提防个中的dsn,个中server后确定是数据库效劳器称呼,即使该处不精确,须要矫正。其余是uid和pwd能否精确;再有,即使open吩咐运用了session,则须要提防 session("customers_runtimeusername") = "sa" session("customers_runtimepassword") = "" 能否精确。 3. runat运用题目   在剧本语法中,有runat参数,表白该剧本是运转在效劳器上仍旧存户机上。即使有runat=server则剧本运转在效劳器上,由asp证明步调来证明实行,并将截止传播给www效劳器;要不即是运转在存户机上,由欣赏器的剧本假造机证明实行,这时候,和普遍的剧本没有辨别。以是,确定要提防asp语法中的吩咐,如:request,querystring,write等吩咐或东西必需在完备runat参数的剧本运转;而考察html的form东西的剧本确定没有runat参数,由于html的form是存户机上面的东西,效劳器没辙考察。 4. 没辙向sql server插入日子字段   即使遇到必需运用美利坚合众国日子方法插入日子的情景,则须要在效劳器的地区树立上树立华夏长日子方法,请更加提防,asp是在效劳器上运转的,天生的html截止传播给欣赏器,以是,一切方法树立必需在效劳器上。 5. 怎样向存户机推送提醒消息   即使在效劳器上确定考察缺点,如备案波折、无权操纵记载等须要提醒用户的消息。这个消息须要推送给存户机上,并展示提醒窗口,这是常常遇到的题目。这个功夫,必需运用动静页面包车型的士办法,由于缺点是在效劳器上确定的,而提醒是在欣赏器上展示的。咱们 不妨运用底下的asp来推送缺点: on error resume next conn=server.createobject("adodb.connection") conn.open "pubs","wlf","" '即使备案波折则缺点数大于0 if conn.errors.count>0 then ‘以次代码天生存户机上的剧本谈话,供给给欣赏器实行 response.write "<script language=javascript>" & chr(13) response.write "{" & chr(13) response.write " window.alert("您无权考察数据库!")" & chr(13) response.write "}" & chr(13) response.write "</script >" & chr(13) end if 6. 存户机尽管运用恒定ip地方 因为asp贯穿数据库是准时的,默许是: session("customers_connectiontimeout") = 15 session("customers_commandtimeout") = 30 两个树立确定的功夫,超时后机动割断贯穿,以是,当革新页面从新实行asp代码时,即使ip调配功夫不够(动静ip调配须要功夫,比静态长很多!),大概没辙贯穿上,则展示缺点消息,以是尽管用静态ip地方。

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.