|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
减少客户内IT专业人才缺乏带来的影响。ASP的客户员工利用浏览器进入相关的应用软件,简单易用,无需专业技术支持。asp+|数据|数据库<%@PageLanguage="VB"%>
<%@ImportNamespace="System.Data"%>
<%@ImportNamespace="System.Data.ADO"%>
<scriptlanguage="VB"runat="server">
SubPage_Load(Srcasobject,EasEventArgs)
IfrblLTorGT.SelectedIndex=-1ThenrblLTorGT.SelectedIndex=0
EndSub
SubbtnRunQuery_OnClick(SenderAsObject,EAsEventArgs)
DimobjConnectionAsADOConnection
DimobjDSCommandAsADODataSetCommand
DimobjDataSetAsDataSet
DimstrSQLQueryAsString
strSQLQuery="SELECT*FROMsample"&_
"WHERE(Sales"&rblLTorGT.SelectedItem.Value.ToString()&""&
txtSalesAmount.Text.ToString()&")"&_
"ORDERBY"&ddlSortBy.SelectedItem.Value.ToString()&
ddlSortOrder.SelectedItem.Value.ToString()
objConnection=NewADOConnection("DBQ="&Server.MapPath("database.mdb")&";Driver=
{MicrosoftAccessDriver(*.mdb)};")
objDSCommand=NewADODataSetCommand(strSQLQuery,objConnection)
objDataSet=NewDataSet()
objDSCommand.FillDataSet(objDataSet,"sample")
lblSQLCommandLabel.Text=strSQLQuery
EmployeeDataGrid.DataSource=objDataSet.Tables("sample").DefaultView
EmployeeDataGrid.DataBind()
EndSub
</script>
<html>
<body>
<formaction="database.aspx"method="post"runat="server">
<strong>Sales:</strong><br/>
<tableborder="0">
<tr><td>
<asp:RadioButtonListid="rblLTorGT"runat="server">
<asp:ListItemvalue="<"runat="server">LessThan</asp:ListItem>
<asp:ListItemvalue=">"runat="server">Greater
Than</asp:ListItem>
</asp:RadioButtonList>
</td><td>
<asp:TextBoxid="txtSalesAmount"runat="server"/>
<asp:RequiredFieldValidatorrunat="server"
id="validSalesEntry"controlToValidate="txtSalesAmount"
errorMessage="Youmustenterasalesamount!"
display="dynamic"
/>
<asp:RangeValidatorrunat="server"
id="validSalesAmount"controlToValidate="txtSalesAmount"
type="Integer"minimumValue="-32000"maximumValue="+32000"
errorMessage="Youmustenteraninteger!"
display="dynamic"
/>
</td></tr>
</table>
<strong>SortBy:</strong><br/>
<asp:DropDownListid="ddlSortBy"runat="server">
<asp:ListItemvalue="id">Id</asp:ListItem>
<asp:ListItemvalue="last_name">LastName</asp:ListItem>
<asp:ListItemvalue="first_name">FirstName</asp:ListItem>
<asp:ListItemvalue="sales">Sales</asp:ListItem>
</asp:DropDownList>
<asp:DropDownListid="ddlSortOrder"runat="server">
<asp:ListItemvalue="ASC">Ascending</asp:ListItem>
<asp:ListItemvalue="DESC">Descending</asp:ListItem>
</asp:DropDownList>
<asp:Buttontype="submit"id="btnRunQuery"text="RunQuery"OnClick="btnRunQuery_OnClick"
runat="server"/>
</form>
<p>
<strong>Resultsof:</strong><asp:labelid="lblSQLCommandLabel"runat="server"/>
</p>
<asp:DataGridid="EmployeeDataGrid"HeaderStyle-Font-Bold="True"ToolTip="ThisisCool!"runat="server"
maintainviewstate="false"/>
</body>
</html>
</p>ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。 |
|