|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。毗连数据库OptionExplicit
localvariable(s)toholdpropertyvalue(s)
PrivatelsServerAsStringlocalcopy
PrivatelsDatabaseAsString
localvariable(s)toholdpropertyvalue(s)
PrivatelsUserNameAsStringlocalcopy
PrivatelsPasswordAsStringlocalcopy
PrivatelsSelectSQLAsStringlocalcopy
localvariable(s)toholdpropertyvalue(s)
PrivatelsTableAsStringlocalcopy
PublicPropertyLetTable(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.Table=5
lsTable=vData
EndProperty
PublicPropertyGetTable()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.Table
Table=lsTable
EndProperty
PublicPropertyLetSelectSQL(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.SelectSQL=5
lsSelectSQL=vData
EndProperty
PublicPropertyGetSelectSQL()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.SelectSQL
SelectSQL=lsSelectSQL
EndProperty
PublicPropertyLetPassword(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.Password=5
lsPassword=vData
EndProperty
PublicPropertyGetPassword()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.Password
Password=lsPassword
EndProperty
PublicPropertyLetUserName(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.UserName=5
lsUserName=vData
EndProperty
PublicPropertyGetUserName()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.UserName
UserName=lsUserName
EndProperty
PublicPropertyLetServer(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.Server=5
lsServer=vData
EndProperty
PublicPropertyGetServer()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.Server
Server=lsServer
EndProperty
PublicPropertyLetDatabase(ByValvDataAsString)
usedwhenassigningavaluetotheproperty,ontheleftsideofanassignment.
Syntax:X.Database=5
lsDatabase=vData
EndProperty
PublicPropertyGetDatabase()AsString
usedwhenretrievingvalueofaproperty,ontherightsideofanassignment.
Syntax:Debug.PrintX.Database
Database=lsDatabase
EndProperty
PublicFunctionConnectDatabaseByODBCDNS(lsDNSAsString)AsADODB.Connection
OnErrorGoToErrhandle
DimConnAsNewADODB.Connection
DimstrConnAsString
strConn="DSN="&lsDNS&_
";UID="&lsUserName&_
";Pwd="&lsPassword
IfConn.State=adStateOpenThen
Conn.Close
EndIf
Conn.OpenstrConn
Conn.CursorLocation=adUseClient
SetConnectDatabaseByODBCDNS=Conn
ExitFunction
Errhandle:
Err.Raise102,"DBConn.Cls","CantConnectToThe"&Database&"Database!"
EndFunction
PublicFunctionConnectDatabaseByODBC()AsADODB.Connection
OnErrorGoToErrhandle
DimConnAsNewADODB.Connection
DimstrConnAsString
strConn="Provider=MSDASQL.1"&_
";UserID="&lsUserName&_
";Password="&lsPassword&_
";PersistSecurityInfo=False"&_
";InitialCatalog="&lsDatabase&_
";DataSource="&lsServer
IfConn.State=adStateOpenThen
Conn.Close
EndIf
Conn.OpenstrConn
Conn.CursorLocation=adUseClient
SetConnectDatabaseByODBC=Conn
ExitFunction
Errhandle:
Err.Raise10</p>想法是和程序员的想法不一样的.至于为什么.大家去想一想.跟心理学有关的 |
|