|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。connection|select<%
dimconn
dimstrconn
dimrs
dimstrsql
dimstrsql2
dimstrsql3
dimstrsql4
dimstrsql5
dimstrsql6
dimstrsql7
dimstrsql8
strconn=Driver={SQLServer};Description=example;SERVER=222.222.1.2;UID=webexample;PWD=;DATABASE=webexample"
FormatDeclare&EXECstatementsthatwillbepassed
tothedatabasewiththeoutputparameters
strsql="DECLARE"&CHR(10)&"@Id_Req"&"INT"&CHR(10)
strsql2="exec"&"sp_EmpInfo"&""&request("txtFirstName")&","&""&request("txtLastName")&","&""&request("txtaddress")&","&""&request("txtcity")&","&"@Id_Req"&"OUTPUT"&chr(10)
Formatsoneormoresqlstatementsthatwillbepassedtothe
databaseInthisexamplesIusesixdifferentways.
strsql3="SELECT*FROMAllDataWHERERecordId=@Id_Req"&Chr(10)
strsql4="SELECTAllData.fname,AllData.lnameFROMAlldataWHERERecordId=@Id_Req"&Chr(10)
strsql5="SELECTAllData.fnameFROMAllDataWHERERecordId=@Id_Req"&Chr(10)
strsql6="SELECTAllData.lnameFROMAllDataWHERERecordId=@Id_Req"&Chr(10)
strsql7="SELECTAllData.AddressFROMAllDataWHERERecordId=@Id_Req"&Chr(10)
strsql8="SELECTAllData.cityFROMAllDataWHERERecordId=@Id_Req"&Chr(10)
Putstogetherallofthelocalvariablesintoonevariable
Thatwillbeusedbytherecordsetobject
strsql=strsql&strsql2&strsql3&strsql4&strsql5&strsql6&strsql7&strsql8
Thisisoptionalthiswritesoutthestrsqllocalvariable
thatwillbepassedtothedatabase
response.write"<b>"&"SqlStatementthatispassedtothedatabase"&"</b>"&"<br>"
response.writestrsql&"<br>"&"<br>"
setsaconnection&recordsetobjectsandexecutesthestrsqllocalvariable
setconn=server.createobject("adodb.connection")
conn.openstrconn
setrs=server.createobject("adodb.recordset")
rs.openstrsql,conn
Parsesouttheindividualrecordsetsandplacesthem
intoindividualtablerows
intcount=1
DoUntilrsIsNothing
response.write"<tableborder=1width=25%>"
response.write"<b>Contentsofrecordset#"&intCount&"</b><br>"
Parsesouttheindividualrecordsetsandplacesthemintotablerows
DoWhileNotrs.EOF
response.write"<TR>"
ForEachoFieldInRS.Fields
response.write"<TH>"&oField.Name&"</TH>"
Next
Response.write"</TR>"&"<TR>"
ForEachoFieldInRS.Fields
response.write"<TDALIGN=center>"
IfIsNull(oField)Then
Response.Write""
Else
Response.WriteoField.Value
EndIf
response.write"</TD>"
Next
rs.MoveNext
Loop
UsestheNEXTRECORDSETMethod
Setrs=rs.NextRecordset
intCount=intCount+1
response.write"</table>"
Loop
%></p>ASP是依赖组件的,能访问数据库的组件好多就有好多种,再有就是你微软的工具可是什么都要收钱的啊! |
|