|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
对用户来说可预见费用、节约费用,可以做到花少钱办大事。由于省去了购买软件和硬件等的前期费用,用户可以租用较高级的应用软件。ASP的收费是根据软件的类型、客制化程度、用户数量、服务期限来定的,对客户来说这笔费用是可以预见的。方便于客户应用软件的升级。存储历程|纪录集|详解以下是asp代码(demo.asp):
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<!--#includefile="adovbs.inc"-->
<%
’通用的ASP读取MSSQL存储历程代码示例
’前往一时表纪录集
’带传送参数
dimconn,connstr,cmd,rs
connstr="Provider=SQLOLEDB;server=服务器盘算机名或IP地点;uid=用户名;pwd=暗码;DATABASE=数据库称号;"’毗连数据库字符串
Setconn=Server.CreateObject("ADODB.Connection")’创立conn工具
conn.openconnstr’翻开数据库
SetCmd=server.CreateObject("Adodb.Command")’创立command工具
Cmd.ActiveConnection=conn
Cmd.CommandText="存储历程名"’挪用存储历程称号
Cmd.CommandType=4
cmd.prepared=true
Cmd.Parameters.AppendCmd.CreateParameter("fyear",adInteger,1,2,"2007")’示例传送给存储历程一个年份,范例是integer,对应存储过程当中的@fyear变量
Cmd.Parameters.AppendCmd.CreateParameter("myname",adVarChar,adParamInput,50,"阿里西西")’示例传送给存储历程一其中笔墨符,范例是varchar,长度为50,对应存储过程当中的@myname变量
setrs=Cmd.execute
’<!--轮回显现前往纪录集全体纪录-->
whilenotrs.eof
response.write"<div>"&rs(0)&"|"&rs(1)&"|"&rs(2)&"</div>"
rs.movenext
wend
’<!--轮回显现前往纪录集全体纪录-->
’<!--开释工具-->
rs.close
setrs=nothing
conn.close
setconn=nothing
setcmd=nothing
’<!--开释工具-->
%>
以下是存储历程代码:
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSOFF
GO
ALTERPROCEDURE存储历程名
(
@fyearint,
@mynamevarchar(50)
)
AS
setnocounton
begin
--创立一时表
createtable#tmp_demo(tmp_fyearint,tmp_namevarchar(50),tmp_infovarchar(2000),tmp_sumint,tmp_intint)
insertinto#tmp_demoselectfyear,fname,finfo,sum(fsum),
isnull((selectfintfromtb2wherefid=tb1.fidandfname=tb1.fname),0)
fromtb1
groupbyfnameorderbyfname
--示例判别并前往纪录
if(@fyear’’and@myname=’’)
select*from#tmp_demowheretmp_fyear=@fyearorderbytmp_sumdesc
elseif(@fyear’’and@myname’’)
select*from#tmp_demowheretmp_fyear=@fyearandtmp_name=@mynameorderbytmp_sumdesc
else
select*from#tmp_demoorderbytmp_sumdesc
end
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO
以下adovbs.inc代码:
<%
’--------------------------------------------------------------------
’MicrosoftADO
’
’(c)1996MicrosoftCorporation.AllRightsReserved.
’
’
’
’ADOconstantsincludefileforVBScript
’
’--------------------------------------------------------------------
’----CursorTypeEnumValues----
ConstadOpenForwardOnly=0
ConstadOpenKeyset=1
ConstadOpenDynamic=2
ConstadOpenStatic=3
’----CursorOptionEnumValues----
ConstadHoldRecords=&H00000100
ConstadMovePrevious=&H00000200
ConstadAddNew=&H01000400
ConstadDelete=&H01000800
ConstadUpdate=&H01008000
ConstadBookmark=&H00002000
ConstadApproxPosition=&H00004000
ConstadUpdateBatch=&H00010000
ConstadResync=&H00020000
ConstadNotify=&H00040000
’----LockTypeEnumValues----
ConstadLockReadOnly=1
ConstadLockPessimistic=2
ConstadLockOptimistic=3
ConstadLockBatchOptimistic=4
’----ExecuteOptionEnumValues----
ConstadRunAsync=&H00000010
’----ObjectStateEnumValues----
ConstadStateClosed=&H00000000
ConstadStateOpen=&H00000001
ConstadStateConnecting=&H00000002
ConstadStateExecuting=&H00000004
’----CursorLocationEnumValues----
ConstadUseServer=2
ConstadUseClient=3
’----DataTypeEnumValues----
ConstadEmpty=0
ConstadTinyInt=16
ConstadSmallInt=2
ConstadInteger=3
ConstadBigInt=20
ConstadUnsignedTinyInt=17
ConstadUnsignedSmallInt=18
ConstadUnsignedInt=19
ConstadUnsignedBigInt=21
ConstadSingle=4
ConstadDouble=5
ConstadCurrency=6
ConstadDecimal=14
ConstadNumeric=131
ConstadBoolean=11
ConstadError=10
ConstadUserDefined=132
ConstadVariant=12
ConstadIDispatch=9
ConstadIUnknown=13
ConstadGUID=72
ConstadDate=7
ConstadDBDate=133
ConstadDBTime=134
ConstadDBTimeStamp=135
ConstadBSTR=8
ConstadChar=129
ConstadVarChar=200
ConstadLongVarChar=201
ConstadWChar=130
ConstadVarWChar=202
ConstadLongVarWChar=203
ConstadBinary=128
ConstadVarBinary=204
ConstadLongVarBinary=205
’----FieldAttributeEnumValues----
ConstadFldMayDefer=&H00000002
ConstadFldUpdatable=&H00000004
ConstadFldUnknownUpdatable=&H00000008
ConstadFldFixed=&H00000010
ConstadFldIsNullable=&H00000020
ConstadFldMayBeNull=&H00000040
ConstadFldLong=&H00000080
ConstadFldRowID=&H00000100
ConstadFldRowVersion=&H00000200
ConstadFldCacheDeferred=&H00001000
’----EditModeEnumValues----
ConstadEditNone=&H0000
ConstadEditInProgress=&H0001
ConstadEditAdd=&H0002
ConstadEditDelete=&H0004
’----RecordStatusEnumValues----
ConstadRecOK=&H0000000
ConstadRecNew=&H0000001
ConstadRecModified=&H0000002
ConstadRecDeleted=&H0000004
ConstadRecUnmodified=&H0000008
ConstadRecInvalid=&H0000010
ConstadRecMultipleChanges=&H0000040
ConstadRecPendingChanges=&H0000080
ConstadRecCanceled=&H0000100
ConstadRecCantRelease=&H0000400
ConstadRecConcurrencyViolation=&H0000800
ConstadRecIntegrityViolation=&H0001000
ConstadRecMaxChangesExceeded=&H0002000
ConstadRecObjectOpen=&H0004000
ConstadRecOutOfMemory=&H0008000
ConstadRecPermissionDenied=&H0010000
ConstadRecSchemaViolation=&H0020000
ConstadRecDBDeleted=&H0040000
’----GetRowsOptionEnumValues----
ConstadGetRowsRest=-1
’----PositionEnumValues----
ConstadPosUnknown=-1
ConstadPosBOF=-2
ConstadPosEOF=-3
’----enumValues----
ConstadBookmarkCurrent=0
ConstadBookmarkFirst=1
ConstadBookmarkLast=2
’----MarshalOptionsEnumValues----
ConstadMarshalAll=0
ConstadMarshalModifiedOnly=1
’----AffectEnumValues----
ConstadAffectCurrent=1
ConstadAffectGroup=2
ConstadAffectAll=3
’----FilterGroupEnumValues----
ConstadFilterNone=0
ConstadFilterPendingRecords=1
ConstadFilterAffectedRecords=2
ConstadFilterFetchedRecords=3
ConstadFilterPredicate=4
’----SearchDirectionValues----
ConstadSearchForward=1
ConstadSearchBackward=-1
’----ConnectPromptEnumValues----
ConstadPromptAlways=1
ConstadPromptComplete=2
ConstadPromptCompleteRequired=3
ConstadPromptNever=4
’----ConnectModeEnumValues----
ConstadModeUnknown=0
ConstadModeRead=1
ConstadModeWrite=2
ConstadModeReadWrite=3
ConstadModeShareDenyRead=4
ConstadModeShareDenyWrite=8
ConstadModeShareExclusive=&Hc
ConstadModeShareDenyNone=&H10
’----IsolationLevelEnumValues----
ConstadXactUnspecified=&Hffffffff
ConstadXactChaos=&H00000010
ConstadXactReadUncommitted=&H00000100
ConstadXactBrowse=&H00000100
ConstadXactCursorStability=&H00001000
ConstadXactReadCommitted=&H00001000
ConstadXactRepeatableRead=&H00010000
ConstadXactSerializable=&H00100000
ConstadXactIsolated=&H00100000
’----XactAttributeEnumValues----
ConstadXactCommitRetaining=&H00020000
ConstadXactAbortRetaining=&H00040000
’----PropertyAttributesEnumValues----
ConstadPropNotSupported=&H0000
ConstadPropRequired=&H0001
ConstadPropOptional=&H0002
ConstadPropRead=&H0200
ConstadPropWrite=&H0400
’----ErrorValueEnumValues----
ConstadErrInvalidArgument=&Hbb9
ConstadErrNoCurrentRecord=&Hbcd
ConstadErrIllegalOperation=&Hc93
ConstadErrInTransaction=&Hcae
ConstadErrFeatureNotAvailable=&Hcb3
ConstadErrItemNotFound=&Hcc1
ConstadErrObjectInCollection=&Hd27
ConstadErrObjectNotSet=&Hd5c
ConstadErrDataConversion=&Hd5d
ConstadErrObjectClosed=&He78
ConstadErrObjectOpen=&He79
ConstadErrProviderNotFound=&He7a
ConstadErrBoundToCommand=&He7b
ConstadErrInvalidParamInfo=&He7c
ConstadErrInvalidConnection=&He7d
ConstadErrStillExecuting=&He7f
ConstadErrStillConnecting=&He81
’----ParameterAttributesEnumValues----
ConstadParamSigned=&H0010
ConstadParamNullable=&H0040
ConstadParamLong=&H0080
’----ParameterDirectionEnumValues----
ConstadParamUnknown=&H0000
ConstadParamInput=&H0001
ConstadParamOutput=&H0002
ConstadParamInputOutput=&H0003
ConstadParamReturnValue=&H0004
’----CommandTypeEnumValues----
ConstadCmdUnknown=&H0008
ConstadCmdText=&H0001
ConstadCmdTable=&H0002
ConstadCmdStoredProc=&H0004
’----SchemaEnumValues----
ConstadSchemaProviderSpecific=-1
ConstadSchemaAsserts=0
ConstadSchemaCatalogs=1
ConstadSchemaCharacterSets=2
ConstadSchemaCollations=3
ConstadSchemaColumns=4
ConstadSchemaCheckConstraints=5
ConstadSchemaConstraintColumnUsage=6
ConstadSchemaConstraintTableUsage=7
ConstadSchemaKeyColumnUsage=8
ConstadSchemaReferentialContraints=9
ConstadSchemaTableConstraints=10
ConstadSchemaColumnsDomainUsage=11
ConstadSchemaIndexes=12
ConstadSchemaColumnPrivileges=13
ConstadSchemaTablePrivileges=14
ConstadSchemaUsagePrivileges=15
ConstadSchemaProcedures=16
ConstadSchemaSchemata=17
ConstadSchemaSQLLanguages=18
ConstadSchemaStatistics=19
ConstadSchemaTables=20
ConstadSchemaTranslations=21
ConstadSchemaProviderTypes=22
ConstadSchemaViews=23
ConstadSchemaViewColumnUsage=24
ConstadSchemaViewTableUsage=25
ConstadSchemaProcedureParameters=26
ConstadSchemaForeignKeys=27
ConstadSchemaPrimaryKeys=28
ConstadSchemaProcedureColumns=29
%>
减少客户内IT专业人才缺乏带来的影响。ASP的客户员工利用浏览器进入相关的应用软件,简单易用,无需专业技术支持。 |
|