|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
SQLServer是基于服务器端的中型的数据库,可以适合大容量数据的应用,在功能上管理上也要比Access要强得多。在处理海量数据的效率,后台开发的灵活性,可扩展性等方面强大。**************************************
Name:BatchUpdateusingADO
Description:ADOhasagreatbatchupda
tefeaturethatnotmanypeopletakeadv
antageof.Youcanuseittoupdatemany
recordsatoncewithoutmakingmultiple
roundtripstothedatabase.Hereishow
touseit.
By:FoundontheWorldWideWeb
Inputs:None
Returns:None
Assumes:None
SideEffects:None
Warranty:
codeprovidedbyPlanetSourceCode(tm)
(http://www.Planet-Source-Code.com)as
is,withoutwarrantiesastoperformanc
e,fitness,merchantability,andanyothe
rwarranty(whetherexpressedorimplied
).
**************************************
<HTML>
<HEAD><TITLE>PlaceDocumentTitleHere</TITLE></HEAD>
<BODYBGColor=ffffffText=000000>
<%
Setcn=Server.CreateObject("ADODB.Connection")
Setrs=Server.CreateObject("ADODB.RecordSet")
cn.OpenApplication("guestDSN")
rs.ActiveConnection=cn
rs.CursorType=adOpenStatic
rs.LockType=adLockBatchOptimistic
rs.Source="SELECT*FROMauthors"
rs.Open
If(rs("au_fname")="Paul")or(rs("au_fname")="Johnson")Then
newval="Melissa"
Else
newval="Paul"
EndIf
Iferr0Then
%>
<B>ErroropeningRecordSet</B>
<%Else%>
<B>OpenedSuccessfully</B><P>
<%EndIf%>
<H2>BeforeBatchUpdate</H2>
<TABLEBORDER=1>
<TR>
<%Fori=0Tors.Fields.Count-1%>
<TD><B><%=rs(i).Name%></B></TD>
<%Next%>
</TR>
<%Forj=1To5%>
<TR>
<%Fori=0Tors.Fields.Count-1%>
<TD><%=rs(i)%></TD>
<%Next%>
</TR>
<%
rs.MoveNext
Next
rs.MoveFirst
%>
</TABLE>
MoverandomlyInthetableandperformupdatesTotable.<BR>
<%
Randomize
r1=Int(rnd*3)+1nItterations
r2=Int(rnd*2)+1nplacesskippedbetweenupdates
Fori=1Tor1
response.write"Itteration:"&i&"<BR>"
rs("au_fname")=newval
Forj=1Tor2
rs.MoveNext
response.write"MoveNext<BR>"
Next
Next
rs.UpdateBatchadAffectAll
rs.Requery
rs.MoveFirst
%>
<%rs.MoveFirst%>
<H2>AfterChanges</H2>
<TABLEBORDER=1>
<TR>
<%Fori=0Tors.Fields.Count-1%>
<TD><B><%=rs(i).Name%></B></TD>
<%Next%>
</TR>
<%Forj=1To5%>
<TR>
<%Fori=0Tors.Fields.Count-1%>
<TD><%=rs(i)%></TD>
<%Next%>
</TR>
<%
rs.MoveNext
Next
rs.Close
Cn.Close
%>
</TABLE>
ASP.NET和ASP的比较,技术上比较已经没什么可说的了.新一代在大部分程度来说当然是比旧一代好了.关键看你对所做软件的理解了.因人而定.会写的话也可能比ASP.NET写得更有效率和更方便重用 |
|