﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-H_J_H-文章分类-Asp/Asp.Net 集锦大集合</title><link>http://www.cnitblog.com/Johncools/category/1947.html</link><description>------专用杂物房</description><language>zh-cn</language><lastBuildDate>Fri, 07 Oct 2011 00:19:12 GMT</lastBuildDate><pubDate>Fri, 07 Oct 2011 00:19:12 GMT</pubDate><ttl>60</ttl><item><title>《ASP.NET技术详解与应用实例》配套源代码下载 </title><link>http://www.cnitblog.com/Johncools/articles/12627.html</link><dc:creator>H_J_H</dc:creator><author>H_J_H</author><pubDate>Wed, 21 Jun 2006 06:47:00 GMT</pubDate><guid>http://www.cnitblog.com/Johncools/articles/12627.html</guid><wfw:comment>http://www.cnitblog.com/Johncools/comments/12627.html</wfw:comment><comments>http://www.cnitblog.com/Johncools/articles/12627.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Johncools/comments/commentRss/12627.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Johncools/services/trackbacks/12627.html</trackback:ping><description><![CDATA[
		<span style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> 
<p>《ASP.NET技术详解与应用实例》配套源代码下载 （机械工业出版社 2005－10 第一版  李万宝编著）<a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第1章.rar" target=""><br /><br />第一章源代码下载</a></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第3章.rar" target="">第三章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第4章.rar" target="">第四章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第5章.rar" target="">第五章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第6章.rar" target="">第六章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第7章.rar" target="">第七章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第8章.rar" target="">第八章源代码下载<br /></a></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第9章.rar" target="">第九章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第10章.rar" target="">第十章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第11章.rar" target="">第十一章源代码下载<br /></a></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第12章.rar" target="">第十二章源代码下载</a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第13章.rar" target="">第十三章源代码下载<br /></a><br /></p><p><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第14章.rar" target="">第十四章源代码下载</a><br /><br /><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/第15章.rar" target="">第十五章源代码下载</a><br /><br /><br />使用本书源代码必须配合<strong>自带的数据库，</strong>请务必下载并还原本书使用的数据库数据库<br /><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/数据库备份文件.rar" target="">数据库备份文件下载：</a><br /><br /><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/光盘代码配置指南.rar" target="">配套源代码使用指南：<br /></a> <br /><br /><strong>补丁</strong>：  <span style="COLOR: #ff0000"><a href="http://mqingqing123.cnblogs.com/Files/mqingqing123/关于不能够还原DotNetForum数据库的问题.rar" target=""><span style="COLOR: #ff0000">关于不能够还原DotNetForum数据库的问题</span></a></span></p><p>有问题请到 <a href="http://bbs.aspcool.com/">http://bbs.aspcool.com</a> 的ASP.NET板块获取帮助，本贴不再提供帮助<br /><br /><a href="http://mqingqing123.cnblogs.com/archive/2006/06/16/276501.html#427293">http://mqingqing123.cnblogs.com/archive/2006/06/16/276501.html#427293</a><br /> </p></span>
<img src ="http://www.cnitblog.com/Johncools/aggbug/12627.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Johncools/" target="_blank">H_J_H</a> 2006-06-21 14:47 <a href="http://www.cnitblog.com/Johncools/articles/12627.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP开发技巧集锦</title><link>http://www.cnitblog.com/Johncools/articles/7465.html</link><dc:creator>H_J_H</dc:creator><author>H_J_H</author><pubDate>Fri, 10 Mar 2006 12:00:00 GMT</pubDate><guid>http://www.cnitblog.com/Johncools/articles/7465.html</guid><wfw:comment>http://www.cnitblog.com/Johncools/comments/7465.html</wfw:comment><comments>http://www.cnitblog.com/Johncools/articles/7465.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Johncools/comments/commentRss/7465.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Johncools/services/trackbacks/7465.html</trackback:ping><description><![CDATA[<P><FONT size=1>1. 几个常用函数 <BR>Round(pi, 2) 四舍五入 </FONT></P>
<P><FONT size=1>FormatNumber(k,4) ' 把 k 格式化为带四位小数点的数。 <BR>eg. 如果k =20000则显示为20,000.00；如果把formatnumber(k,0)则为20,000 </FONT></P>
<P><FONT size=1>Replace(expression,find,replacewith) '返回一字符串，其中指定的子串已被另一个子串替换 </FONT></P>
<P><FONT size=1>Left(String,Length) '返回指定数目的从字符串的左边算起的字符串。 </FONT></P>
<P><FONT size=1>Split(expression[, delimiter[, count[, start]]]) '返回基于 0 的一维数组，其中包含指定数目的子字符串。 <BR>eg. 常用这个 Split(String,[delimiter]) ' 用delimiter(用于标识子字符串界限的字符)来划分字符串 </FONT></P>
<P><FONT size=1>Instr(String1,String2) '返回某字符串在另一字符串中第一次出现的位置 <BR>eg1. if instr(addation,"密码配置表")&lt;&gt;0 then '说明存在 <BR>eg2. if instr(str,”AP”) &gt;0 不好区分str = (AP,AP&amp;AC),此时只要变为（’AP’,’AP&amp;AC’）,再用instr(str,”’AP’”) <BR>2. 弹出窗口Pick值 </FONT></P>
<P><FONT size=1>function pickupSP(spdisid,pjnum,pdcode) <BR>{ <BR>window.opener.&lt;%=theForm%&gt;.RefNum&lt;%=Spid%&gt;.value=spdisid; <BR>window.opener.&lt;%=theForm%&gt;.LineS&lt;%=Spid%&gt;.value=pjnum; <BR>window.opener.&lt;%=theForm%&gt;.kokey&lt;%=Spid%&gt;.value=pdcode; <BR>window.close(); <BR>} <BR>3. ASP控制图片显示的大小（等比例缩放） <BR>&lt;HTML&gt; <BR>&lt;HEAD&gt; <BR>&lt;TITLE&gt; New Document &lt;/TITLE&gt; <BR>&lt;script language="JavaScript"&gt; <BR>&lt;!-- <BR>var flag=false; <BR>function DrawImage(ImgD){ <BR>var image=new Image(); <BR>image.src=ImgD.src; <BR>if(image.width&gt;0 &amp;&amp; image.height&gt;0){ <BR>flag=true; <BR>if(image.width/image.height&gt;= 164/112){ <BR>if(image.width&gt;164){ <BR>ImgD.width=164; <BR>ImgD.height=(image.height*164)/image.width; <BR>}else{ <BR>ImgD.width=image.width; <BR>ImgD.height=image.height; <BR>} <BR>ImgD.alt=image.width+"x"+image.height; <BR>} <BR>else{ <BR>if(image.height&gt;112){ <BR>ImgD.height=112; <BR>ImgD.width=(image.width*112)/image.height; <BR>}else{ <BR>ImgD.width=image.width; <BR>ImgD.height=image.height; <BR>} <BR>ImgD.alt=image.width+"x"+image.height; <BR>} <BR>} <BR>} <BR>//--&gt; <BR>&lt;/script&gt; <BR>&lt;/HEAD&gt; <BR>&lt;BODY&gt; <BR>&lt;a href="./img.jpg" target="_blank"&gt;&lt;img src="./img.jpg" border="0" width="164" height="112" onload="javascript:DrawImage(this);"&gt;&lt;/a&gt; <BR>&lt;/BODY&gt; <BR>&lt;/HTML&gt; <BR>4. ASP中对数据库表的操作(INSERT/UPDATE/DELETE),可使用事务处理,并支持多事务处理. <BR>在ASP的数据库对象链接对象中,提供了一下属性: <BR>BeginTrans 事务开始 <BR>CommitTrans 事务提交 <BR>RollbackTrans 事务回滚 <BR>&lt;% <BR>On Error Resume Next ’错误发生后继续处理 <BR>'Asp中使用事务 <BR>Set conn=Server.CreateObject("ADODB.Connection") <BR>conn.Open "course_dsn","course_user","course_password" <BR>conn.begintrans '开始事务 <BR>sql="delete from user_info" <BR>set rs=server.createobject("adodb.recordset") <BR>rs.open sql,conn,3,3 <BR>if conn.errors.count&gt;0 then '有错误发生 <BR>conn.rollbacktrans '回滚 <BR>set rs=nothing <BR>conn.close <BR>set conn=nothing <BR>response.write "交易失败，回滚至修改前的状态！" <BR>response.end <BR>else <BR>conn.committrans '提交事务 <BR>set rs=nothing <BR>conn.close <BR>set conn=nothing <BR>response.write "交易成功！" <BR>response.end <BR>end if <BR>%&gt; <BR>在ASP中,不提供事务的结束,BeginTrans只作用于自己的域,类似于变量声明一样,如果在函数体内BeginTrans,则事物只作用于本函数体,如果BeginTrans在函数体外,处于页面级,则事务的作用域从BeginTrans开始,到页面的结束均处于事务的管理状态下. <BR>5. EasySales数据库操作 </FONT></P>
<P><FONT size=1>dim objCon,objRst,objsql <BR>dim companyid <BR>Set objCon = Server.CreateObject("ADODB.Connection") <BR>objCon.Open SYSDNS,SYSNAME,SYSPASSWORD <BR>Set objRst = Server.CreateObject("ADODB.RecordSet") <BR>objsql="select * from PasswordConfig where companyid='"&amp;session("CompanyID")&amp;"'" <BR>objRst.Open objsql,objCon,1,3 <BR>6. html格式邮件发送 <BR>HTML = "&lt;html&gt;" <BR>HTML = HTML &amp; "&lt;head&gt;" <BR>HTML = HTML &amp; "&lt;title&gt;Sending CDONTS Email Using HTML&lt;/title&gt;" <BR>HTML = HTML &amp; "&lt;link href="../cn/new.css" rel="stylesheet" type="text/css"&gt;" <BR>HTML = HTML &amp; "&lt;/head&gt;" <BR>HTML = HTML &amp; "&lt;body bgcolor=""FFFFFF""&gt;" <BR>HTML = HTML &amp; "&lt;p&gt;&lt;font size=7&gt;" <BR>HTML = HTML &amp; "This is a test mail in html&lt;br&gt;" <BR>HTML = HTML &amp; "Mail content here ...&lt;/font&gt;&lt;/p&gt;" <BR>HTML = HTML &amp; "&lt;/body&gt;" <BR>HTML = HTML &amp; "&lt;/html&gt;" <BR>dim StrRecEmail,StrPosEmail,StrSubject,StrBody <BR>StrRecEmail=request("email") <BR>StrPosEmail="</FONT><A href="mailto:yufh@alleasy.com.cn"><FONT size=1>yufh@alleasy.com.cn</FONT></A><FONT size=1>" <BR>StrSubject="资料下载通知函" <BR>StrBody=HTML <BR>7. input是下划线 <BR>style="BORDER-RIGHT: #f7f7f7 0px solid; BORDER-TOP: #f7f7f7 0px solid; FONT-SIZE: 9pt; BORDER-LEFT: #f7f7f7 0px solid; WIDTH: 110px; BORDER-BOTTOM: #c0c0c0 1px solid; HEIGHT: 16px; BACKGROUND-COLOR: #f7f7f7" <BR>8. Session &amp; Cookie <BR>写入一个SESSION：　 <BR>　　 Session["username"])="aa"; <BR>　　 Session("username")="aa" 　　 <BR>　　 读取一个SESSINN： 　　 <BR>　　 string username= Session["username"];　 <BR>　　 dim username=Session("username")　　 <BR>　　 Cookie与此用法大致相同 <BR>9. 几个VB中的常数 <BR>下列常数由 Visual Basic for Applications 中的类型库定义，可用来在代码中的任何地方代替实际值： <BR>常数 等于 描述 <BR>vbCrLf Chr(13) + Chr(10) 回车符与换行符结合 <BR>vbCr Chr(13) 回车符 <BR>vbLf Chr(10) 换行符 <BR>vbNewLine Chr(13) + Chr(10) 平台指定的新行字符；适用于当前平台 <BR>vbNullChar Chr(0) 值为 0 的字符 <BR>vbNullString 值为 0 的字符串 用来调用外部过程；与长度为零的字符串 ("") 不同 <BR>vbObjectError -2147221504 用户定义的错误号应当大于该值，例如： <BR>Err.Raise Number = vbObjectError + 1000 <BR>vbTab Chr(9) Tab 字。 <BR>vbBack Chr(8) 退格字符 </FONT></P>
<P><FONT size=1>10. 按钮为不可用 <BR>&lt;%if rsView.eof and rsView.bof then %&gt; ‘ 这里有个大问题，下文再说 <BR>&lt;input name="submit" type='submit' value='对选定用户解鎖' disabled&gt; <BR>&lt;%else%&gt; <BR>&lt;input name="submit" type='submit' value='对选定用户解鎖' &gt; <BR>&lt;/td&gt; <BR>&lt;%end if%&gt; </FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><BR><FONT size=1>11. 报错并返回<BR>if rs.bof and rs.eof then&nbsp; ‘还是有问题<BR>response.write"&lt;SCRIPT language=JavaScript&gt;alert('找不到！');"<BR>response.write"javascript:history.go(-1)&lt;/SCRIPT&gt;"<BR>end if<BR>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<BR>这个是跳转。<BR>&lt;script language="javascript"&gt;<BR>&nbsp;alert('&lt;%=intOperationInfo%&gt;');<BR>&nbsp;window.navigate('ChangePwd.asp');<BR>&lt;/Script&gt;<BR>12. 从VBS到JS，混用<BR>&nbsp;&nbsp; &lt;%<BR>&nbsp;&nbsp; dim checkpwdconfig&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; checkpwdconfig=split(addation,"/")<BR>&nbsp;&nbsp; %&gt;<BR>&nbsp;&nbsp; &lt;script language="javascript"&gt;<BR>&nbsp;&nbsp; alert("&lt;%=checkpwdconfig(0)%&gt;")<BR>&nbsp;&nbsp; &lt;/script&gt; <BR>13. 弹出窗口<BR>&lt;script language=javascript&gt;<BR>function openaddnew()<BR>{<BR>subWindow=window.open("../Edit/PasswordConfigEdit.asp?method=new",'','scrollbars=yes,left=120,top=60,height=250,width=500,menubar=no,location=no,toolbar=no,resizable=yes','')<BR>subWindow.opener = this;<BR>}<BR>&lt;/script&gt;<BR>用一个连接调用：<BR>&lt;a href=""＃""&gt;请修改密码 onClick="openaddnew()"&lt;/a&gt;<BR>图片调用：<BR>&lt;img name=submit1 src="../button_new&lt;%=session("languageid")%&gt;.gif"&nbsp; onClick="openaddnew()"&gt;<BR>14. 分页<BR>&lt;!--#include file="conn.asp"--&gt;<BR>&lt;%<BR>if request("pageno")&lt;&gt;"" then<BR>&nbsp;&nbsp;&nbsp; pageno=int(request("pageno"))<BR>else<BR>&nbsp;pageno=1<BR>end if<BR>sql="select * from news where [language]='中文' and bigclassname='新闻' order by id desc"<BR>Set rs= Server.CreateObject("ADODB.Recordset")<BR>rs.open sql,conn,1,3<BR>rs.pagesize=20<BR>if rs.eof then<BR>pageno=0<BR>else <BR>rs.absolutepage=pageno<BR>end if<BR>%&gt;<BR>==========================================<BR>共&lt;%=rs.recordcount%&gt;条,&lt;%=pageno%&gt;/&lt;%=int(rs.pagecount)%&gt;页,每页&lt;%=rs.pagesize%&gt;条<BR>&nbsp; &lt;a href="manage.asp?pageno=1"&gt;首页&lt;/a&gt;<BR>&nbsp; &lt;%if pageno&gt;1 then%&gt;<BR>&nbsp; &lt;a href="manage.asp?pageno=&lt;%=int(pageno)-1%&gt;"&gt;上一页&lt;/a&gt;<BR>&nbsp; &lt;%<BR>&nbsp; end if<BR>&nbsp; if int(pageno)&lt;&gt;int(rs.pagecount)then<BR>%&gt;<BR>&nbsp; &lt;a href="manage.asp?pageno=&lt;%=int(pageno+1)%&gt;"&gt;下一页&lt;/a&gt;<BR>&nbsp; &lt;%end if%&gt;<BR>&nbsp; &lt;a href="manage.asp?pageno=&lt;%=int(rs.pagecount)%&gt;"&gt;尾页&lt;/a&gt;<BR>&nbsp; &lt;%rs.close%&gt;<BR>&nbsp; &lt;%<BR>call CloseConn()<BR>%&gt;<BR>15. 数据库更新<BR>&nbsp; sql="select * from [user] where username='"&amp;request("username")&amp;"'"<BR>&nbsp; rs.Open sql,Conn,1,3<BR>&nbsp; rs("usermail")=Request("usermail")<BR>&nbsp; rs("userhome")=Request("userhome"))<BR>&nbsp; rs.update<BR>&nbsp; rs.close<BR>16. 关闭独立窗口<BR>&lt;head&gt;<BR>&lt;OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff- 11cf-9377-00aa003b7a11"&gt;&lt;param name="Command" value="Close"&gt;<BR>&lt;/object&gt;<BR>&lt;/head&gt;<BR>&lt;body&gt;<BR>&lt;input type="button" value="点击我关闭窗口" onclick="closes.Click();"&gt;<BR>&lt;/body&gt;<BR>17. 极细表格<BR>&lt;table border="1" cellpadding="0" cellspacing="0" width="32" height="32" bordercolorlight="#000000" bordercolordark="#FFFFFF"&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;　&lt;/td&gt; <BR>&lt;/tr&gt; <BR>&lt;/table&gt; <BR>18. 几个正则表达式<BR>Require : /.+/,&nbsp;&nbsp;&nbsp; <BR>Email : /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/,&nbsp;&nbsp;&nbsp; <BR>Phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,&nbsp;&nbsp;&nbsp; <BR>Mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/,&nbsp;&nbsp;&nbsp; <BR>Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&amp;_~`@[\]\':+!]*([^&lt;&gt;\"\"])*$/,&nbsp;&nbsp;&nbsp; <BR>IdCard : /^\d{15}(\d{2}[A-Za-z0-9])?$/,&nbsp;&nbsp;&nbsp; <BR>Currency : /^\d+(\.\d+)?$/, <BR>Number : /^\d+$/,&nbsp;&nbsp;&nbsp; <BR>Zip : /^[1-9]\d{5}$/,&nbsp;&nbsp;&nbsp; <BR>QQ : /^[1-9]\d{4,8}$/,&nbsp;&nbsp;&nbsp; <BR>Integer : /^[-\+]?\d+$/,&nbsp;&nbsp;&nbsp; <BR>Double : /^[-\+]?\d+(\.\d+)?$/,&nbsp;&nbsp;&nbsp; <BR>English : /^[A-Za-z]+$/,&nbsp;&nbsp;&nbsp; <BR>Chinese :&nbsp; /^[\u0391-\uFFE5]+$/,&nbsp;&nbsp;&nbsp; <BR>UnSafe :/^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&amp;\*\.\(\)\[\]\{\}&lt;&gt;\?\\\/\'\"]*)|.{0,5})$|\s/,<BR>19. Left应用（控制字数）<BR>function title(str) <BR>if len(trim(str))&gt;=28 then <BR>title=left(trim(str),27)&amp;"..." <BR>else <BR>title=trim(str) <BR>end if <BR>end function <BR>20. 判断浏览器<BR>&lt;SCRIPT LANGUAGE="javascript1.2"&gt; <BR>&lt;!--// <BR>if (navigator.appName == 'Netscape') <BR>var language = navigator.language; <BR>else <BR>var language = navigator.browserLanguage; <BR>if (language.indexOf('en') &gt; -1) document.location.href = 'en/index.asp'; <BR>else if (language.indexOf('zh') &gt; -1) document.location.href = 'cn/index.asp'; <BR>else <BR>document.location.href = 'cn/index.asp'; <BR>// End --&gt; <BR>&lt;/script&gt; <BR>&nbsp; <BR>21. 嵌入另一页 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&nbsp; &lt;iframe class="TBGen" style="top:2px" ID="UploadFiles" src="upload.asp" frameborder=0 scrolling=no width="250" height="25"&gt;&lt;/iframe&gt;</FONT></P>
<P><FONT size=1>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<BR>其实也可以用&lt;!--#include file="fuck.asp"--&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>22. 全部选定 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;SCRIPT language=javascript&gt;<BR>function CheckAll(form)<BR>&nbsp; {<BR>&nbsp; for (var i=0;i&lt;form.elements.length;i++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; var e = form.elements[i];<BR>&nbsp;&nbsp;&nbsp; if (e.Name != "chkAll")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.checked = form.chkAll.checked;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>&lt;/script&gt;<BR>引用：<BR>&lt;td width="250" height="30"&gt;&lt;input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox"&gt;选中本页显示的所有&lt;/td&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>小格：<BR>&lt;input name='username' type='checkbox'&nbsp; id="username" value="&lt;%=cstr(rsView("username"))%&gt;"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>23. 如何处理页面执行时发生的错误？ </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;%@ LANGUAGE="VBScript" %&gt;<BR>&lt;% <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Buffer = True ' 打开页面缓冲<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On Error Resume Next&nbsp; ' 打开错误处理<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; …………' ASP代码<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;% <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Err.Number &lt;&gt; 0 Then&nbsp; ' 错误处理<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Clear&nbsp; ' 清除缓冲区<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;HTML&gt;' 显示错误信息页面<BR>&lt;HEAD&gt;<BR>&lt;TITLE&gt;页面错误报告&lt;/TITLE&gt;<BR>&lt;/HEAD&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;BODY BGCOLOR="#C0C0C0"&gt;<BR>&lt;font color=red&gt;<BR>&lt;p&gt;页面错误报告&lt;/p&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>错误号:&lt;%= Err.Number %&gt;&lt;BR&gt;<BR>错误描述:&lt;%= Err.Description %&gt;&lt;BR&gt; <BR>错误源:Source &lt;%= Err.Source %&gt;&lt;BR&gt;<BR>错误发生行:&lt;%= Err.Line %&gt;&lt;BR&gt;<BR>&lt;/BODY&gt;<BR>&lt;/HTML&gt;<BR>&lt;% <BR>End If<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>24. 收藏夹图标. </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>在 HEAD 部分加入下面的内容:&nbsp; <BR>&lt;LINK REL="SHORTCUT ICON" HREF=http://www.alleasy.com.cn/alleasy.ico&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>在地址栏加入图标（图标必须是.ico格式，并且要加入收藏后才有效）<BR>在HEAD里加入 &lt;link rel="shortcut icon" href="favicon.ico"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>25. 校验提交表单（正则表达式应用） </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;script language="JavaScript"&gt;<BR>&lt;!--<BR>function CheckForm()<BR>{ <BR>if (LoginID.value =="")<BR>{<BR>alert("请填写您的登录名！");<BR>LoginID.focus();<BR>return false;<BR>}<BR>var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;<BR>if (!filter.test(LoginID.value)) { <BR>alert("用户名填写不正确,请重新填写！可使用的字符为（A-Z a-z 0-9 _ - .)长度不小于5个字符，不超过15个字符，注意不要使用空格。"); <BR>LoginID.focus();<BR>LoginID.select();<BR>return false; <BR>} <BR>if (Password.value =="") <BR>{<BR>alert("请填写您的密码！");<BR>Password.focus();<BR>return false; <BR>}<BR>var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;<BR>if (!filter.test(Password.value)) { <BR>alert("密码填写不正确,请重新填写！可使用的字符为（A-Z a-z 0-9 _ - .)长度不小于5个字符，不超 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>过15个字符，注意不要使用空格。"); <BR>Password.focus();<BR>Password.select();<BR>return false; <BR>} <BR>if (Password.value != ConfirmPassword.value) <BR>{<BR>alert("请两次填写的密码不一致，请重新填写！");<BR>ConfirmPassword.focus();<BR>return false; <BR>}<BR>if (CompanyName.value =="")<BR>{<BR>alert("请填写贵公司名称！");<BR>CompanyName.focus();<BR>return false;<BR>}<BR>var filter=/^[a-zA-Z][a-zA-Z0-9._-]*@([a-zA-Z0-9-_]+\.)+(com|gov|net|com\.cn|edu\.cn)$/;<BR>if(!filter.test(document.myform.Email.value)){<BR>alert("邮箱格式不正确!"); <BR>document.myform.Email.focus();<BR>return false;<BR>}<BR>myform.submit();<BR>return true;<BR>}<BR>//--&gt;<BR>&lt;/SCRIPT&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>统一一下，以后都这样写<BR>&lt;form method="POST" name="myform"&nbsp; action="Checkreg.asp" &gt;<BR>&lt;/form&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;input type="button" name="Submit" value="提交" onClick="CheckForm();"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>26. 循环 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;%<BR>dim sql,rs<BR>set rs=server.createobject("ADODB.recordset")<BR>sql="select * from news where bigclassname='解决方案'"<BR>rs.open sql,conn,1,3<BR>for k=1 to rs.recordcount<BR>if rs.eof then<BR>exit for<BR>else<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;tr&gt;<BR>&nbsp;&lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asfasdf<BR>&nbsp;&lt;/td&gt;<BR>&lt;/tr&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;% <BR>rs.movenext<BR>end if<BR>next<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>27. 另一个只能输入数字代码 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;script language=java script&gt;<BR>&nbsp;function check(){<BR>&nbsp;&nbsp; if(isNaN(tt.value))<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert("必须是数字!");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tt.value="";<BR>&nbsp;&nbsp;&nbsp; }<BR>&lt;/script&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;input type="text" name="tt" onkeyup="check();"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>28. 有选择显示 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>function showco(va)<BR>{&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; if (va=="CO")<BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RefNum.style.display=''; //不再用这个可以直接用 block<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buttonsp.style.display='none';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (va=="SP")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buttonco.style.display='none';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buttonsp.style.display='';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kokey.style.display='';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (va=="Inventory")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RefNum.style.display='none'; //不显示<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reftr.style.display="block"; //显示<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>调用： </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;select name="RefType" style='width:77pt'&nbsp; onChange="showco(this.value)"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp; &lt;option value="Inventory"&gt;Inventory&lt;/option&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp; &lt;option value="CO" &gt;CO&lt;/option&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp; &lt;option&nbsp; value="SP"&gt;SP&lt;/option&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;/select&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>选择显示行 &lt;tr id="Reftr" name="Reftr" style="display:none"&gt;也可以用&lt;div id=”Resftr” &gt;&lt;/div&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>29. 调试参数显示规范 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>Response.Write session("LoginCompanyId")&amp;","&amp;Date&amp;","&amp;Request.Form("Owner")&amp;","&amp;Request.Form("Name")&amp;<BR>//注意最后没有"只是在，之间用","&nbsp;&nbsp; 其他用&amp;&amp;引用即可<BR>//也就是说只是用&nbsp; &amp;","&amp;&nbsp; 中间加一个逗号，其他的该怎么写，就怎么写<BR>Response.End </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>30. 从数据库填充下拉菜单 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;%<BR>sql = "select * from BigClass"<BR>rs.open sql,conn,1,1<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;select name="BigClassName" size="1"&gt;<BR>&lt;option selected value="&lt;%=trim(rs("BigClassName"))%&gt;"&gt;&lt;%=trim(rs("BigClassName"))%&gt;&lt;/option&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;%<BR>rs.movenext //不能少，否则重复<BR>do while not rs.eof<BR>%&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;option value="&lt;%=trim(rs("BigClassName"))%&gt;"&gt;&lt;%=trim(rs("BigClassName"))%&gt;&lt;/option&gt;<BR>&lt;%<BR>rs.movenext<BR>loop<BR>rs.close<BR>%&gt;<BR>&lt;/select&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>//以下是新方法 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&nbsp;&lt;select name="SrcNo"&gt;<BR>&lt;%do while not SrcRs.eof%&gt;<BR>&lt;option value="&lt;%=trim(SrcRs("Cost"))%&gt;" <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;% <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if Trim(SrcComRs("SrcNo")) = Trim(SrcRs("Cost")) then <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response.Write "selected" <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&lt;%=trim(SrcRs("Cost"))%&gt;<BR>&lt;/option&gt;<BR>&lt;%<BR>&nbsp;&nbsp; SrcRs.movenext<BR>&nbsp;&nbsp;&nbsp; loop<BR>&nbsp;&nbsp;&nbsp; SrcRs.close<BR>%&gt;<BR>&lt;/select&gt; </FONT></P>
<P><BR><FONT size=1>31. 确认操作 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>function ConfirmDel()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; if(confirm("确定要删除吗？一旦删除将不能恢复！"))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>} </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;form name="del" method="Post" action="Del.asp" onsubmit="return ConfirmDel();"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>============================================================== </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>我自己用的一个。<BR>function ConfirmReset()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; if(confirm("确定取消操作吗？一旦取消操作将不能恢复！"))<BR>&nbsp;&nbsp;&nbsp;&nbsp; window.form1.reset();<BR>&nbsp;&nbsp;&nbsp;&nbsp; // return true;<BR>}<BR>&lt;a href="javascript:ConfirmReset();"&gt;&lt;img src="button_cance.gif"&gt;&lt;/a&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>32. indexOf() 用法 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;字符串对象&gt;.indexOf(&lt;另一个字符串对象&gt;[, &lt;起始位置&gt;])； </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>该方法从&lt;字符串对象&gt;中查找&lt;另一个字符串对象&gt;（如果给出&lt;起始位置&gt;就忽略之前的位置），如果找到了，就返回它的位置，没有找到就返回“-1”。所有的“位置”都是从零开始的。<BR>eg. Str.indexOf(“AP”)&gt;-1 说明str中存在”AP”字符串 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>33. 生成流水号 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;%<BR>if request.form("Modf") &lt;&gt; "" then<BR>Dim&nbsp; rs<BR>Dim sql<BR>Dim BugID<BR>dim today<BR>today=date()<BR>toyear=year(today)<BR>toyear=toyear*10000<BR>tomonth= month(today)<BR>tomonth=tomonth*100<BR>tonow=day(today)<BR>Serialnum = toyear + tomonth + tonow<BR>Serialnum = Serialnum*10000+1 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>set rs = Server.CreateObject("ADODB.recordset")<BR>sql = "select top 1 * from buglist order by SubmitDate desc"<BR>rs.open sql,conn,1,3<BR>if&nbsp; not rs.eof then<BR>&nbsp;&nbsp;&nbsp;&nbsp; Dim OldSerialnum<BR>&nbsp;&nbsp;&nbsp;&nbsp; OldSerialnum = Rs("BugID")<BR>&nbsp;&nbsp;&nbsp;&nbsp; OldSerialnum = right(OldSerialnum,12)<BR>&nbsp;&nbsp;&nbsp;&nbsp; Serial = right(Serialnum,12)<BR>&nbsp;&nbsp;&nbsp;&nbsp; if OldSerialnum - Serial &gt;= 0 then<BR>&nbsp;&nbsp;&nbsp;&nbsp; Serialnum = OldSerialnum + 1<BR>&nbsp;&nbsp;&nbsp;&nbsp; end if <BR>end if<BR>BugID = "ES"&amp;request("ProductVersion")&amp;Serialnum </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>34. 响应回车 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>function getdata(what,whatid)<BR>{<BR>&nbsp;&nbsp;&nbsp; if (event.keyCode==13)<BR>&nbsp;&nbsp;&nbsp; ……<BR>&lt;input name="SerialNum&lt;%=i%&gt;"&nbsp;&nbsp; type="text" onKeyDown="getdata(window.form1.SerialNum&lt;%=i%&gt;.value,&lt;%=i%&gt;)"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>35. 关闭窗口前刷新父页面 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>response.write "&lt;script language = javascript&gt;"<BR>response.write "javascript:opener.location.reload(); "<BR>response.write "javasript:window.close();&lt;/script&gt;" </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>36. JS事件 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>事件 / 描述 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>onblur 事件 发生在窗口失去焦点的时候。<BR>onchange 事件 发生在文本输入区的内容被更改，然后焦点从文本输入区移走之后。<BR>onclick 事件 发生在对象被单击的时候。<BR>onerror 事件 发生在错误发生的时候。<BR>onfocus 事件 发生在窗口得到焦点的时候。<BR>onload 事件 发生在文档全部下载完毕的时候。<BR>onmousedown 事件 发生在用户把鼠标放在对象上按下鼠标键的时候。参考 onmouseup 事件。<BR>onmouseout 事件 发生在鼠标离开对象的时候。参考 onmouseover 事件。<BR>onmouseover 事件 发生在鼠标进入对象范围的时候。<BR>onmouseup 事件 发生在用户把鼠标放在对象上鼠标键被按下的情况下，放开鼠标键的时候。<BR>onreset 事件 发生在表单的“重置”按钮被单击（按下并放开）的时候。<BR>onresize 事件 发生在窗口被调整大小的时候。<BR>onsubmit 事件 发生在表单的“提交”按钮被单击（按下并放开）的时候。<BR>onunload 事件 发生在用户退出文档（或者关闭窗口，或者到另一个页面去）的时候。<BR>onSelect 当Text或Textarea对象中的文字被加亮后，引发该事件。 <BR>onFocus 当用户单击Text或textarea以及select对象时，产生该事件。 <BR>onBlur 当text对象或textarea对象以及select对象不再拥有焦点、而退到后台时，引发该文件. <BR>onDragDrog 拖放时发生<BR>onLoseCapture&nbsp; <BR>onDblClick 鼠标双击事件 <BR>onKeyPress 当键盘上的某个键被按下并且释放时触发的事件.[注意:页面内必须有被聚焦的对象] <BR>onKeyDown 当键盘上某个按键被按下时触发的事件[注意:页面内必须有被聚焦的对象] <BR>onKeyUp 当键盘上某个按键被按放开时触发的事件[注意:页面内必须有被聚焦的对象] <BR>onAbort 图片在下载时被用户中断 <BR>onBeforeUnload 当前页面的内容将要被改变时触发的事件 <BR>onMove 浏览器的窗口被移动时触发的事件 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>37. 自动最大化 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>function window_onload()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; window.moveTo(-2,-2);<BR>&nbsp;&nbsp;&nbsp;&nbsp; window.resizeTo(screen.availWidth, screen.availHeight);<BR>} </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>&lt;body onload="window_onload()"&gt; </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>38. 几个SQL技巧 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>SELECT Area,Territory,username,sum(dealqty) DealQty,count(Projectnum) ProjectQty,sum(TotalAmount) TotalAmountQty,sum(TotalPowerRT) TotalPowerRT&nbsp; FROM VW_PreviewTerritory&nbsp; where&nbsp;&nbsp; username = '段龙义' group by area,Territory,username<BR>只要把不需要统计的东西分组就可以了。 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>select area,count(projectnum) TotalProjectQty,sum(DealQty) TotalDealQty,sum(TotalAmount) TotalAmountQty,sum(TotalPowerRT) TotalPowerRTQty from vw_previewProject where username = 'admin' group by area<BR>这个也是一样，记住：count() 只是计数，不管这个字段值是多少。sum()是求和，把所有加在一起。 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>39. Eval用法 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>eval("ProducingArea"+i+".style.display = 'none' ;");<BR>单引号不影响<BR>eval("if((window.form1.ProductBaseType"+i+".value!='' &amp;&amp; window.form1.ProductBaseType"+(i+1)+".value =='')==true);");<BR>//错误！<BR>if(eval("window.form1.ProductBaseType"+i+".value!='' &amp;&amp; window.form1.ProductBaseType"+(i+1)+".value ==''")==true)<BR>//以后记得凡是有if判断的，把eval("")写在里面，就比较好！<BR>if(confirm(eval("'确信要在'+window.form1.ProductBaseType"+(i)+".value+'后添加子类？'"))) </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>40. 窗口关闭之前 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>function window_onbeforeunload(Projectnum)<BR>{<BR>&nbsp;&nbsp; if (event.clientX &gt; document.body.clientWidth &amp;&amp; event.clientY &lt; 0 )<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oXMLHTTP.open("POST","CheckProjectDeal.asp?Projectnum="+Projectnum,false);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oXMLHTTP.send();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Str=unescape(oXMLHTTP.responseText);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (unescape(oXMLHTTP.responseText)!="YES")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.event.returnValue="项目至少需要一个销售机会！";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>} </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>41. 标准表格 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>* 这个是标题</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>&lt;table cellspacing=0 cellpadding=0 width="100%" border=0&gt;</FONT></P>
<P><FONT size=1>&nbsp; &lt;tr&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&nbsp; class=title&nbsp; nowrap&nbsp; align=left&gt;<BR>&lt;%response.write Application("LProductManage"&amp;session("LanguageId"))%&gt; </FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;/td&gt;</FONT></P>
<P><FONT size=1>&nbsp; &lt;/tr&gt;</FONT></P>
<P><FONT size=1>&lt;/table&gt;</FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>* 这个是横线</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>&lt;table cellspacing=0 cellpadding=0 width="100%" border=0&gt;</FONT></P>
<P><FONT size=1>&nbsp; &lt;tbody&gt; </FONT></P>
<P><FONT size=1>&nbsp; &lt;tr&gt; </FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;td&gt; </FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;/td&gt;</FONT></P>
<P><FONT size=1>&nbsp; &lt;/tr&gt;<BR>&lt;tr class="linecolor"&gt;</FONT></P>
<P><FONT size=1>&lt;td height="2"&gt;&lt;/td&gt;</FONT></P>
<P><FONT size=1>&lt;/tr&gt; <BR>&lt;tr&gt;</FONT></P>
<P><FONT size=1>&lt;td class="tdcolor" align=left height=15&gt;&amp;nbsp;&lt;/td&gt;</FONT></P>
<P><FONT size=1>&lt;/tr&gt;</FONT></P>
<P><FONT size=1>&nbsp; &lt;/tbody&gt;</FONT></P>
<P><FONT size=1>&lt;/table&gt;</FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>* 这个是表格</FONT></P>
<P><FONT size=1>***************</FONT></P>
<P><FONT size=1>&lt;table border=0 cellpadding=0 cellspacing=1 width=100% bgcolor="#d0d090"&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp; &lt;tbody&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp;&nbsp; &lt;th align="middle" class=light2&gt;&lt;b&gt;&lt;%=application("Lstatus"&amp;session("languageid"))%&gt;&lt;/b&gt;&lt;/th&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp;&nbsp; &lt;th align="middle" class=light2&gt;&lt;b&gt;&lt;%=application("LSaleStage"&amp;session("languageid"))%&gt;&lt;/b&gt;&lt;/th&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;tr bgColor="white"&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;td align="middle"&gt;&amp;nbsp;&lt;/td&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;td align="middle"&gt;&amp;nbsp;&lt;/td&gt;</FONT></P>
<P><FONT size=1>&nbsp;&nbsp;&nbsp; &lt;/tr&gt;</FONT></P>
<P><BR><FONT size=1>&nbsp; &lt;/tbody&gt;</FONT></P>
<P><FONT size=1>&lt;/table&gt;</FONT></P>
<P><BR><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>边框\填充 = 0</FONT></P>
<P><FONT size=1>间隔 ＝ 1</FONT></P>
<P><FONT size=1>底色 = #d0d090</FONT></P>
<P><FONT size=1>42. 这也行 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>for i=2 to num</FONT></P>
<P><FONT size=1>&nbsp; BaseTypeAllPArr = request("BaseType"&amp;i&amp;"P"&amp;jLoop)&amp;":"&amp;BaseTypeAllPArr</FONT></P>
<P><FONT size=1>&nbsp; response.Write "&nbsp; OOOO&nbsp; "&amp;request("BaseType"&amp;i&amp;"P"&amp;jLoop)&amp;"&nbsp; OOOO&nbsp;&nbsp; &lt;br&gt;"<BR>next </FONT></P>
<P><FONT size=1>43. 标准注释头 </FONT></P>
<P><FONT size=1>&nbsp;</FONT></P>
<P><FONT size=1>'' ******************************************************************</FONT></P>
<P><FONT size=1>'' 文件名:</FONT></P>
<P><FONT size=1>'' Copyright (c) 2001-2005 ××信息技术公司软件部</FONT></P>
<P><FONT size=1>'' 功能描述:产品编辑</FONT></P>
<P><FONT size=1>'' 参数</FONT></P>
<P><FONT size=1>'' 牵涉数据表，视图，存储过程：自定义函数dbo.GetSubTreeinfo</FONT></P>
<P><FONT size=1>'' 包含的文件:</FONT></P>
<P><FONT size=1>'' 调用的公用函数，类，方法</FONT></P>
<P><FONT size=1>'' 创建人:Kokey YU </FONT></P>
<P><FONT size=1>'' 日　期: 2005-8-9</FONT></P>
<P><FONT size=1>'' 修改人:</FONT></P>
<P><FONT size=1>'' 日　期:</FONT></P>
<P><FONT size=1>'' 修改说明:</FONT></P>
<P><FONT size=1>'' 版　本:</FONT></P>
<P><FONT size=1>'' ******************************************************************/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></P>
<P><FONT size=1>44. title换行 </FONT></P>
<P><FONT size=1>&lt;a href="javascript:;" title="这是一行&amp;#13这是另一行！"&gt;把鼠标放上来&lt;/a&gt; </FONT></P><img src ="http://www.cnitblog.com/Johncools/aggbug/7465.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Johncools/" target="_blank">H_J_H</a> 2006-03-10 20:00 <a href="http://www.cnitblog.com/Johncools/articles/7465.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XMLHTTP对象及其方法</title><link>http://www.cnitblog.com/Johncools/articles/6726.html</link><dc:creator>H_J_H</dc:creator><author>H_J_H</author><pubDate>Sun, 19 Feb 2006 10:03:00 GMT</pubDate><guid>http://www.cnitblog.com/Johncools/articles/6726.html</guid><wfw:comment>http://www.cnitblog.com/Johncools/comments/6726.html</wfw:comment><comments>http://www.cnitblog.com/Johncools/articles/6726.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Johncools/comments/commentRss/6726.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Johncools/services/trackbacks/6726.html</trackback:ping><description><![CDATA[<P>MSXML中提供了Microsoft.XMLHTTP对象，能够完成从数据包到Request对象的转换以及发送任务。 <BR>创建XMLHTTP对象的语句如下： <BR>Set objXML = CreateObject("Msxml2.XMLHTTP") 或 <BR>Set objXML = CreateObject(“Microsoft.XMLHTTP”) <BR>' Or, for version 3.0 of XMLHTTP, use: <BR>' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP") <BR>对象创建后调用Open方法对Request对象进行初始化，语法格式为： <BR>poster.open http-method, url, async, userID, password <BR>Open方法中包含了5个参数，前三个是必要的，后两个是可选的(在服务器需要进行身份验证时提供)。参数的含义如下所示：&nbsp; <BR>http-method： HTTP的通信方式，比如GET或是 POST <BR>url： 接收XML数据的服务器的URL地址。通常在URL中要指明 ASP或CGI程序 <BR>async： 一个布尔标识，说明请求是否为异步的。如果是异步通信方式(true)，客户机就不等待服务器的响应；如果是同步方式(false)，客户机就要等到服务器返回消息后才去执行其他操作 <BR>userID 用户ID，用于服务器身份验证 <BR>password 用户密码，用于服务器身份验证 <BR>XMLHTTP对象的Send方法 <BR>用Open方法对Request对象进行初始化后，调用Send方法发送XML数据： <BR>poster.send XML-data <BR>Send方法的参数类型是Variant，可以是字符串、DOM树或任意数据流。发送数据的方式分为同步和异步两种。在异步方式下，数据包一旦发送完毕，就结束Send进程，客户机执行其他的操作；而在同步方式下，客户机要等到服务器返回确认消息后才结束Send进程。 <BR>XMLHTTP对象中的readyState属性能够反映出服务器在处理请求时的进展状况。客户机的程序可以根据这个状态信息设置相应的事件处理方法。属性值及其含义如下表所示： <BR>值 说明 <BR>0 Response对象已经创建，但XML文档上载过程尚未结束 <BR>1 XML文档已经装载完毕 <BR>2 XML文档已经装载完毕，正在处理中 <BR>3 部分XML文档已经解析 <BR>4 文档已经解析完毕，客户端可以接受返回消息 <BR>客户机处理响应信息 <BR>客户机接收到返回消息后，进行简单的处理，基本上就完成了C/S之间的一个交互周期。客户机接收响应是通过XMLHTTP对象的属性实现的： <BR>● responseTxt：将返回消息作为文本字符串； <BR>● responseXML：将返回消息视为XML文档，在服务器响应消息中含有XML数据时使用； <BR>● responseStream：将返回消息视为Stream对象。 <BR></P>
<P>如果要跨浏览器如firefox则: <BR>
<SCRIPT language=javascript>
         //jb函数会根据不同的浏览器初始化个xmlhttp对象
         function jb()
         {
            var A=null; 
               try 
               { 
                   A=new ActiveXObject("Msxml2.XMLHTTP"); 
                } 
            catch(e)
            { 
                  try 
                   { 
                      A=new ActiveXObject("Microsoft.XMLHTTP"); 
                   }
             catch(oc)
            { 
                     A=null 
                   } 
              } 
           if ( !A && typeof XMLHttpRequest != "undefined" ) 
            { 
               A=new XMLHttpRequest() 
             } 
           return A 
         }<!--EndFragment-->
</BODY></HTML></SCRIPT>
&lt;SCRIPT language=javascript&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //jb函数会根据不同的浏览器初始化个xmlhttp对象 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function jb() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var A=null; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A=new ActiveXObject("Msxml2.XMLHTTP"); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(e) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A=new ActiveXObject("Microsoft.XMLHTTP"); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(oc) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A=null <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( !A &amp;&amp; typeof XMLHttpRequest != "undefined" ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A=new XMLHttpRequest() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return A&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/SCRIPT&gt; <BR><BR>他会根据不同的浏览器返回不同的xmlhttp<BR>具体见:<BR><A href="http://jibbering.com/2002/4/httprequest.html">http://jibbering.com/2002/4/httprequest.html</A></P><IMG height=1 src="http://pwqzc.cnblogs.com/aggbug/254798.html" width=1><BR><BR>
<DIV align=right>一帆(老鼠粮仓之路) 2005-10-14 14:32 </DIV><img src ="http://www.cnitblog.com/Johncools/aggbug/6726.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Johncools/" target="_blank">H_J_H</a> 2006-02-19 18:03 <a href="http://www.cnitblog.com/Johncools/articles/6726.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.NET中各种数据库连接大全</title><link>http://www.cnitblog.com/Johncools/articles/5707.html</link><dc:creator>H_J_H</dc:creator><author>H_J_H</author><pubDate>Thu, 22 Dec 2005 15:10:00 GMT</pubDate><guid>http://www.cnitblog.com/Johncools/articles/5707.html</guid><wfw:comment>http://www.cnitblog.com/Johncools/comments/5707.html</wfw:comment><comments>http://www.cnitblog.com/Johncools/articles/5707.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/Johncools/comments/commentRss/5707.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/Johncools/services/trackbacks/5707.html</trackback:ping><description><![CDATA[<LI style="LIST-STYLE-IMAGE: url(icon/iconsql.gif)"><FONT size=1>&nbsp;SQL Server </FONT>
<UL><SPAN id=sqlserver><SPAN class=seclvl ondblclick=menu(sqlserverodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserverodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsql.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=sqlserverodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard Security:</B><BR>"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Trusted connection:</B><BR>"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Prompt for username and password:</B><BR>oConn.Properties("Prompt") = adPromptAlways<BR>oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(sqlserveroledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserveroledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsql.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=sqlserveroledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard Security:</B><BR>"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Trusted Connection:</B><BR>"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" </FONT>
<BLOCKQUOTE><I><FONT size=1>(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Prompt for username and password:</B><BR>oConn.Provider = "sqloledb"<BR>oConn.Properties("Prompt") = adPromptAlways<BR>oConn.Open "Data Source=Aron1;Initial Catalog=pubs;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Connect via an IP address:</B><BR>"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;" </FONT>
<BLOCKQUOTE><I><FONT size=1>(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))</FONT></I></BLOCKQUOTE></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(sqlserveradonet); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserveradonet); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsql.gif)"><FONT size=1>&nbsp;SqlConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=sqlserveradonet style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard Security:</B><BR>"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Trusted Connection:</B><BR>"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" </FONT>
<BLOCKQUOTE><I><FONT size=1>(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Connect via an IP address:</B><BR>"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;" </FONT>
<BLOCKQUOTE><I><FONT size=1>(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Declare the SqlConnection:</B><BR></FONT>
<BLOCKQUOTE><I><FONT size=1><U>C#:</U><BR>using System.Data.SqlClient;<BR>SqlConnection oSQLConn = new SqlConnection();<BR>oSQLConn.ConnectionString="my connectionstring";<BR>oSQLConn.Open(); <BR><BR><U>VB.NET:</U><BR>Imports System.Data.SqlClient<BR>Dim oSQLConn As SqlConnection = New SqlConnection()<BR>oSQLConn.ConnectionString="my connectionstring"<BR>oSQLConn.Open() <BR><BR></FONT></I></BLOCKQUOTE></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(sqlserverother); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserverother); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsql.gif)"><FONT size=1>&nbsp;Data Shape </FONT></SPAN><BR><BR><SPAN id=sqlserverother style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>MS Data Shape</B><BR>"Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=Aron1;Initial Catalog=pubs;User ID=sa;Password=asdasd;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(sqlserverreadmore); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserverreadmore); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconreadmore.gif)"><FONT size=1>&nbsp;Read more </FONT></SPAN><BR><BR><SPAN id=sqlserverreadmore style="CURSOR: default">
<UL><SPAN class=seclvl ondblclick=menu(sqlserverreadmorenetprot); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserverreadmorenetprot); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconreadmoreheader.gif)"><FONT size=1>&nbsp;<B>How to define wich network protocol to use</B><BR><BR></FONT></SPAN><SPAN id=sqlserverreadmorenetprot style="CURSOR: default">
<UL>
<LI style="LIST-STYLE-IMAGE: url(icon/iconreadmoretext.gif)"><FONT size=1>Example:<BR>"Provider=sqloledb;Data Source=190.190.200.100,1433;<B><U>Network Library=DBMSSOCN</U></B>;Initial Catalog=pubs;User ID=sa;Password=asdasd;" <BR><BR></FONT>
<TABLE>
<TBODY>
<TR>
<TD width=100><B><U><FONT size=1>Name</FONT></U></B></TD>
<TD><B><U><FONT size=1>Network library</FONT></U></B></TD></TR>
<TR>
<TD><FONT size=1>dbnmpntw</FONT></TD>
<TD><FONT size=1>Win32 Named Pipes</FONT></TD></TR>
<TR>
<TD><FONT size=1>dbmssocn</FONT></TD>
<TD><FONT size=1>Win32 Winsock TCP/IP</FONT></TD></TR>
<TR>
<TD><FONT size=1>dbmsspxn</FONT></TD>
<TD><FONT size=1>Win32 SPX/IPX</FONT></TD></TR>
<TR>
<TD><FONT size=1>dbmsvinn</FONT></TD>
<TD><FONT size=1>Win32 Banyan Vines</FONT></TD></TR>
<TR>
<TD><FONT size=1>dbmsrpcn</FONT></TD>
<TD><FONT size=1>Win32 Multi-Protocol (Windows RPC)</FONT></TD></TR></TBODY></TABLE><BR><BR><FONT size=1><B>Important note!</B> <BR>When connecting through the SQLOLEDB provider use the syntax <I><U>Network Library</U>=dbmssocn</I><BR>and when connecting through MSDASQL provider use the syntax <I><U>Network</U>=dbmssocn</I> <BR><BR></FONT></LI></UL></SPAN></LI></UL>
<UL><SPAN class=seclvl ondblclick=menu(sqlserverreadmoreallprops); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand; COLOR: #222288" onclick=menu(sqlserverreadmoreallprops); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconreadmoreheader.gif)"><FONT size=1>&nbsp;<B>All SqlConnection connectionstring properties</B><BR><BR></FONT></SPAN><SPAN id=sqlserverreadmoreallprops style="CURSOR: default">
<UL>
<LI style="LIST-STYLE-IMAGE: url(icon/iconreadmoretext.gif)"><FONT size=1>This table shows all connectionstring properties for the ADO.NET SqlConnection object. Most of the properties are also used in ADO. All properties and descriptions is from msdn. <BR><BR></FONT>
<TABLE class=normaltxt style="BORDER-COLLAPSE: collapse" borderColor=#aaaaaa cellSpacing=0 cellPadding=4 border=1>
<TBODY>
<TR vAlign=top bgColor=#cccccc>
<TH><FONT size=1>Name</FONT></TH>
<TH><FONT size=1>Default</FONT></TH>
<TH><FONT size=1>Description</FONT></TH></TR>
<TR vAlign=top>
<TD><FONT size=1>Application Name</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The name of the application, or '.Net SqlClient Data Provider' if no application name is provided.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>AttachDBFilename<BR>-or-<BR>extended&nbsp;properties<BR>-or-<BR>Initial File Name</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The name of the primary file, including the full path name, of an attachable database. The database name must be specified with the keyword 'database'.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Connect Timeout<BR>-or-<BR>Connection Timeout</FONT></TD>
<TD><FONT size=1>15</FONT></TD>
<TD><FONT size=1>The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Connection Lifetime</FONT></TD>
<TD><FONT size=1>0</FONT></TD>
<TD><FONT size=1>When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server and a server just brought on-line.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Connection Reset</FONT></TD>
<TD><FONT size=1>'true'</FONT></TD>
<TD><FONT size=1>Determines whether the database connection is reset when being removed from the pool. Setting to 'false' avoids making an additional server round-trip when obtaining a connection, but the programmer must be aware that the connection state is not being reset.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Current Language</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The SQL Server Language record name.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Data Source<BR>-or-<BR>Server<BR>-or-<BR>Address<BR>-or-<BR>Addr<BR>-or-<BR>Network Address</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The name or network address of the instance of SQL Server to which to connect.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Enlist</FONT></TD>
<TD><FONT size=1>'true'</FONT></TD>
<TD><FONT size=1>When true, the pooler automatically enlists the connection in the creation thread's current transaction context.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Initial Catalog<BR>-or-<BR>Database</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The name of the database.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Integrated Security<BR>-or-<BR>Trusted_Connection</FONT></TD>
<TD><FONT size=1>'false'</FONT></TD>
<TD><FONT size=1>Whether the connection is to be a secure connection or not. Recognized values are 'true', 'false', and 'sspi', which is equivalent to 'true'.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Max Pool Size</FONT></TD>
<TD><FONT size=1>100</FONT></TD>
<TD><FONT size=1>The maximum number of connections allowed in the pool.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Min Pool Size</FONT></TD>
<TD><FONT size=1>0</FONT></TD>
<TD><FONT size=1>The minimum number of connections allowed in the pool.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Network Library<BR>-or-<BR>Net</FONT></TD>
<TD><FONT size=1>'dbmssocn'</FONT></TD>
<TD><FONT size=1>The network library used to establish a connection to an instance of SQL Server. Supported values include dbnmpntw (Named Pipes), dbmsrpcn (Multiprotocol), dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmsipcn (Shared Memory) and dbmsspxn (IPX/SPX), and dbmssocn (TCP/IP). <BR>The corresponding network DLL must be installed on the system to which you connect. If you do not specify a network and you use a local server (for example, "." or "(local)"), shared memory is used.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Packet Size</FONT></TD>
<TD><FONT size=1>8192</FONT></TD>
<TD><FONT size=1>Size in bytes of the network packets used to communicate with an instance of SQL Server.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Password<BR>-or-<BR>Pwd</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The password for the SQL Server account logging on.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Persist Security Info</FONT></TD>
<TD><FONT size=1>'false'</FONT></TD>
<TD><FONT size=1>When set to 'false', security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Pooling</FONT></TD>
<TD><FONT size=1>'true'</FONT></TD>
<TD><FONT size=1>When true, the SQLConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>User ID</FONT></TD>
<TD><FONT size=1>&nbsp;</FONT></TD>
<TD><FONT size=1>The SQL Server login account.</FONT></TD></TR>
<TR vAlign=top>
<TD><FONT size=1>Workstation ID</FONT></TD>
<TD><FONT size=1>the local computer name</FONT></TD>
<TD><FONT size=1>The name of the workstation connecting to SQL Server.</FONT></TD></TR></TBODY></TABLE><BR><BR><FONT size=1><B>Note</B> <BR>Use ; to separate each property.<BR>If a name occurs more than once, the value from the last one in the connectionstring will be used.<BR>If you are building your connectionstring in your app using values from user input fields, make sure the user can't change the connectionstring by inserting an additional property with another value within the user value. </FONT></LI></UL></SPAN></LI></UL></SPAN></LI></UL></SPAN>
<UL><FONT size=1></FONT></UL><SPAN class=toplvl ondblclick=menu(access); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(access); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconaccess.gif)"><FONT size=1>&nbsp;Access </FONT></SPAN>
<UL><SPAN id=access><SPAN class=seclvl ondblclick=menu(accessodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(accessodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconaccess.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=accessodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard Security:</B><BR>"Driver={Microsoft Access Driver (*.mdb)};Dbq=\somepath\mydb.mdb;Uid=Admin;Pwd=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Workgroup:</B><BR>"Driver={Microsoft Access Driver (*.mdb)};Dbq=\somepath\mydb.mdb;SystemDB=\somepath\mydb.mdw;","admin", "" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(jetoledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(jetoledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconaccess.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=jetoledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard security:</B><BR>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Workgroup (system database):</B><BR>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:System Database=system.mdw;","admin", "" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>With password:</B><BR>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;","admin", "" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(oracle); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(oracle); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconoracle.gif)"><FONT size=1>&nbsp;Oracle </FONT></SPAN>
<UL><SPAN id=oracle><SPAN class=seclvl ondblclick=menu(oracleodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(oracleodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconoracle.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=oracleodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>New version:</B><BR>"Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Old version:</B><BR>"Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(oracleoledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(oracleoledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconoracle.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=oracleoledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard security:</B><BR>"Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;" </FONT>
<BLOCKQUOTE><I><FONT size=1>This one's from Microsoft, the following are from Oracle</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Standard Security:</B><BR>"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Trusted Connection:</B><BR>"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(oracleadonet); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(oracleadonet); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconoracle.gif)"><FONT size=1>&nbsp;OracleConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=oracleadonet style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard:</B><BR>"Data Source=Oracle8i;Integrated Security=yes"; </FONT>
<BLOCKQUOTE><I><FONT size=1>This one works only with Oracle 8i release 3 or later</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Declare the OracleConnection:</B><BR></FONT>
<BLOCKQUOTE><I><FONT size=1><U>C#:</U><BR>using System.Data.OracleClient;<BR>OracleConnection oOracleConn = new OracleConnection();<BR>oOracleConn.ConnectionString = "my connectionstring";<BR>oOracleConn.Open(); <BR><BR><U>VB.NET:</U><BR>Imports System.Data.OracleClient<BR>Dim oOracleConn As OracleConnection = New OracleConnection()<BR>oOracleConn.ConnectionString = "my connectionstring"<BR>oOracleConn.Open() <BR><BR></FONT></I></BLOCKQUOTE></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(oracleother); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(oracleother); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconoracle.gif)"><FONT size=1>&nbsp;Data Shape </FONT></SPAN><BR><BR><SPAN id=oracleother style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>MS Data Shape:</B><BR>"Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;user id=username;password=mypw" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(mysql); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(mysql); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconmysql.gif)"><FONT size=1>&nbsp;MySQL </FONT></SPAN>
<UL><SPAN id=mysql><SPAN class=seclvl ondblclick=menu(mysqlodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(mysqlodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconmysql.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=mysqlodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Local database:</B><BR>"Driver={mySQL};Server=mySrvName;Option=16834;Database=mydatabase;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Remote database:</B><BR>"Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(mysqloledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(mysqloledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconmysql.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=mysqloledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard:</B><BR>"Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd;" </FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(mysqladonet); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(mysqladonet); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconmysql.gif)"><FONT size=1>&nbsp;MySqlConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=mysqladonet style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>EID:</B><BR>"Data Source=server;Database=mydb;User ID=username;Password=pwd;Command Logging=false" </FONT>
<BLOCKQUOTE><I><FONT size=1>This one is used with </FONT><A href="http://www.einfodesigns.com/"><FONT size=1>eInfoDesigns</FONT></A><FONT size=1> dbProvider, an add-on to .NET</FONT></I></BLOCKQUOTE>
<LI><FONT size=1>&nbsp;<B>Declare the MySqlConnection:</B><BR></FONT>
<BLOCKQUOTE><I><FONT size=1><U>C#:</U><BR>using EID.MySqlClient;<BR>MySqlConnection oMySqlConn = new MySqlConnection();<BR>oMySqlConn.ConnectionString = "my connectionstring";<BR>oMySqlConn.Open(); <BR><BR><U>VB.NET:</U><BR>Imports EID.MySqlClient<BR>Dim oMySqlConn As MySqlConnection = New MySqlConnection()<BR>oMySqlConn.ConnectionString = "my connectionstring"<BR>oMySqlConn.Open() <BR><BR></FONT></I></BLOCKQUOTE></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(db2); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(db2); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondb2.gif)"><FONT size=1>&nbsp;IBM DB2 </FONT></SPAN>
<UL><SPAN id=db2><SPAN class=seclvl ondblclick=menu(db2oledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(db2oledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondb2.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) from ms </FONT></SPAN><BR><BR><SPAN id=db2oledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>TCP/IP:</B><BR>"Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=MyUser;Password=MyPW" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>APPC:</B><BR>"Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=MyUser;Password=MyPW" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(sybase); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(sybase); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsybase.gif)"><FONT size=1>&nbsp;Sybase </FONT></SPAN>
<UL><SPAN id=sybase><SPAN class=seclvl ondblclick=menu(sybaseodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(sybaseodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconsybase.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=sybaseodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard:</B><BR>"Driver={SYBASE SYSTEM 11};Srvr=Aron1;Uid=username;Pwd=password;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Intersolv 3.10:</B><BR>"Driver={INTERSOLV 3.10 32-BIT Sybase};Srvr=Aron1;Uid=username;Pwd=password;" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(informix); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(informix); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconinformix.gif)"><FONT size=1>&nbsp;Informix </FONT></SPAN>
<UL><SPAN id=informix><SPAN class=seclvl ondblclick=menu(informixodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(informixodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconinformix.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=informixodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Informix 3.30:</B><BR>"Dsn='';Driver={INFORMIX 3.30 32 BIT};Host=hostname;Server=myserver;Service=service-name;Protocol=olsoctcp;Database=mydb;UID=username;PWD=myPwd <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>Informix-CLI 2.5:</B><BR>"Driver={Informix-CLI 2.5 (32 Bit)};Server=myserver;Database=mydb;Uid=username;Pwd=myPwd" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(dsn); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(dsn); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondsn.gif)"><FONT size=1>&nbsp;DSN </FONT></SPAN>
<UL><SPAN id=dsn><SPAN class=seclvl ondblclick=menu(dsnodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(dsnodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondsn.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=dsnodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>DSN:</B><BR>"DSN=myDsn;Uid=username;Pwd=;" <BR><BR></FONT>
<LI><FONT size=1>&nbsp;<B>File DSN:</B><BR>"FILEDSN=c:\myData.dsn;Uid=username;Pwd=;" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(excel); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(excel); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconexcel.gif)"><FONT size=1>&nbsp;Excel </FONT></SPAN>
<UL><SPAN id=excel><SPAN class=seclvl ondblclick=menu(excelodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(excelodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconexcel.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=excelodbc style="CURSOR: default">
<UL>
<LI style="LIST-STYLE-IMAGE: url(icon/iconexcel.gif)"><FONT size=1>&nbsp;<B>Standard:</B><BR>"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\mypath;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(exceloledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(exceloledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconexcel.gif)"><FONT size=1>&nbsp;OLE DB </FONT></SPAN><BR><BR><SPAN id=exceloledb style="CURSOR: default">
<UL>
<LI style="LIST-STYLE-IMAGE: url(icon/iconexcel.gif)"><FONT size=1>&nbsp;<B>Standard:</B><BR>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=Excel 8.0;HDR=Yes;" </FONT>
<BLOCKQUOTE><I><FONT size=1>"HDR=Yes;" indicates that the first row contains columnnames, not data</FONT></I></BLOCKQUOTE></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(dbf); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(dbf); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondbf.gif)"><FONT size=1>&nbsp;DBF / FoxPro </FONT></SPAN>
<UL><SPAN id=dbf><SPAN class=seclvl ondblclick=menu(dbfodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(dbfodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondbf.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=dbfodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>standard:</B><BR>"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mydbpath;" <BR><BR></FONT></LI></UL></SPAN><SPAN class=seclvl ondblclick=menu(dbfoledb); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(dbfoledb); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/icondbf.gif)"><FONT size=1>&nbsp;OLEDB, OleDbConnection (.NET) </FONT></SPAN><BR><BR><SPAN id=dbfoledb style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>standard:</B><BR>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password=" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(pervasive); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(pervasive); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconpervasive.gif)"><FONT size=1>&nbsp;Pervasive </FONT></SPAN>
<UL><SPAN id=pervasive><SPAN class=seclvl ondblclick=menu(pervasiveodbc); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(pervasiveodbc); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconpervasive.gif)"><FONT size=1>&nbsp;ODBC </FONT></SPAN><BR><BR><SPAN id=pervasiveodbc style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>Standard:</B><BR>"Driver={Pervasive ODBC Client Interface};ServerName=srvname;dbq=@dbname" <BR><BR></FONT></LI></UL></SPAN></SPAN></LI></UL><SPAN class=toplvl ondblclick=menu(udl); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(udl); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconudl.gif)"><FONT size=1>&nbsp;UDL </FONT></SPAN>
<UL><SPAN id=udl><SPAN class=seclvl ondblclick=menu(udludl); onmouseover="this.style.color='#3333CC';" style="CURSOR: hand" onclick=menu(udludl); onmouseout="this.style.color='#222288';">
<LI style="LIST-STYLE-IMAGE: url(icon/iconudl.gif)"><FONT size=1>&nbsp;UDL </FONT></SPAN><BR><BR><SPAN id=udludl style="CURSOR: default">
<UL>
<LI><FONT size=1>&nbsp;<B>UDL:</B><BR>"File Name=c:\myDataLink.udl;" <BR></FONT></LI></UL></SPAN></SPAN></LI></UL></LI><img src ="http://www.cnitblog.com/Johncools/aggbug/5707.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/Johncools/" target="_blank">H_J_H</a> 2005-12-22 23:10 <a href="http://www.cnitblog.com/Johncools/articles/5707.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>