global.asax如下:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %><script language="VB" runat="server" Debug="true" >
Sub Session_Start(Sender As Object, E As EventArgs)
Dim DS As New DataSet
Dim D as string
dim x ,f as string
D="server=localhost;uid=sa;database=northwind"
dim NowConn as New SQLConnection(d)
Session("NowSQL")=NowConn
Session("nowUser")=Request.ServerVariables("REMOTE_HOST")
x=Request.PhysicalApplicationPath
f="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x & "mdb\Employ.mdb"
dim ACConn as New sqlconnection(f)
Session("NowACCSam")=ACConn
f="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x & "mdb\Stock.mdb"
dim ACConn1 as New sqlconnection(f)
Session("NowSTKACC")=ACConn1
D="server=localhost;uid=sa;database=Master"
dim NowConn1 as New SQLConnection(d)
NowConn1.open()
dim re as New SQLCommand
re.Connection=NowConn1
re.CommandText="sp_databases"
re.CommandType = 1
dim k as SQLDataReader
k = re.ExecuteReader()
Do until k.Read=False
If k.GetString(0)="EmploySQL" Then
d="server=localhost;uid=sa;database=EmploySQL"
dim NowConn2 as SQLConnection = New SQLConnection(d)
Session("NowSQLSam")=NowConn2
ElseIf k.GetString(0)="StockSQL" Then
d="server=localhost;uid=sa;database=StockSQL"
dim NowConn3 as SQLConnection = New SQLConnection(d)
Session("NowSTKSQL")=NowConn3
end if
loop
End Sub
Sub Application_BeginRequest(ByVal Sender As Object, ByVal e As EventArgs)
dim x as string
X=Request.ServerVariables("PATH_TRANSLATED")
IF Instr(x,"Usegbl.aspx") > 0 Then
Response.Write(Request.ServerVariables("REMOTE_HOST"))
Response.Write("执行请求中...<br>")
end if
End Sub
Sub Application_EndRequest(ByVal Sender As Object, ByVal e As EventArgs)
dim x as string
X=Request.ServerVariables("PATH_TRANSLATED")
IF Instr(x,"Usegbl.aspx") > 0 Then
Response.Write("执行请求完毕...")
End if
End Sub
</script>buybook.aspx如下:
<html>
<head>
<body background="../../../images/winback.gif">
<!--#INCLUDE FILE="../../../fun.inc"-->
<p>本例档案:BuyBook.aspx 目的:动态产生表格</p>
<p><font size="3">我要订购:(请在订购本数栏位输入数字)</font></p>
<script language="VB" runat="server">
Sub ClickSure(sender As Object, e As EventArgs)
Dim rw As HtmlTableRow
Dim cl As HtmlTableCell
dim x
Span1.InnerHTML="选择内容:"
rw = new HtmlTableRow()'建立新表格列
cl=New HtmlTableCell()'建立新储存格
cl.InnerHtml="书名"'输入资料至储存格
rw.Cells.Add(cl)'加入储存格至表格列
cl=New HtmlTableCell()
cl.InnerHtml="本数"
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml="邮购价"
rw.Cells.Add(cl)
Table1.Rows.Add(rw)'加入表格列至表格
if cint(ac3.Value)>0 then
Ctable("Access 2000 VBA研究大观",cint(ac3.Value),510)
x=x+(cint(ac3.Value)*510)
End if
if cint(ac2.Value)>0 then
Ctable("Access 2000专案开发",cint(ac2.Value),455)
x=x+(cint(ac2.Value)*455)
End if
if cint(ac1.Value)>0 then
Ctable("Access 2000学习直导",cint(ac1.Value),320)
x=x+(cint(ac1.Value)*320)
End if
if cint(ac4.Value)>0 then
Ctable("Access 2000实战问答",cint(ac4.Value),390)
x=x+(cint(ac4.Value)*390)
End if
if cint(vb6.Value)>0 then
Ctable("VB 6.0与资料库开发圣经",cint(vb6.Value),320)
x=x+(cint(VB6.Value)*320)
End if
Span2.InnerHTML="总价:" & x
End sub
Sub CTable(BName,Unit,Price)
Dim rw As HtmlTableRow
Dim cl As HtmlTableCell
rw = new HtmlTableRow()
cl=New HtmlTableCell()
cl.InnerHtml=BName
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml=Unit
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml=Price
rw.Cells.Add(cl)
Table1.Rows.Add(rw)
End Sub
</script>
</head>
</blockquote>
<form runat="server">
<table border="1" bordercolor="#FF0000" width="90%">
<tr>
<td align="center" width="30%"><strong>书名</strong></font></td>
<td align="center" width="10%"><strong>售价</strong></font></td>
<td align="center" bordercolor="#0000FF" width="13%"><strong>邮购价</strong></font></td>
<td align="center" width="15%"><strong>折数</strong></font></td>
<td align="center" width="15%"><strong>页数</strong></font></td>
<td width="17%">
<p align="center"><b>订购本数</b></font></p>
</td>
</tr>
<tr>
<td width="30%">Access 2000 VBA研究大观</td>
<td align="right" width="10%">680</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><font color="#FF0000"><b>510</b></font></td>
<td align="center" width="15%">七</font></td>
<td align="center" width="15%">840</font></td>
<td align="center" width="17%"><input type="text" size="10"
id="ac3" value="0" runat="server"></font></td>
</tr>
<tr>
<td width="30%">ACCESS 2000专案开发</td>
<td align="right" width="10%">650</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><font color="#FF0000"><b>455</b></font></td>
<td align="center" width="15%">七</font></td>
<td align="center" width="15%">820</td>
<td align="center" width="17%"><div align="left"><p align="center"><font size="3"><input type="text" size="10"
ID="ac2" value="0" runat="server"></font></p>
</div></td>
</tr>
<tr>
<td width="30%">ACCESS 2000学习直导</font></td>
<td align="right" width="10%">480</font></td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font size="3" color="#FF0000">320</font></b></td>
<td align="center" width="15%">六五</font></td>
<td align="center" width="15%">500</font></td>
<td align="center" width="17%"><input type="text" size="10"
ID="ac1" value="0" runat="server"></font></td>
</tr>
<tr>
<td width="30%">ACCESS 2000实战问答集</a></td>
<td align="right" width="10%">520</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font face="Times New Roman" size="3" color="#FF0000">390</font></b></td>
<td align="center" width="15%">七五</font></td>
<td align="center" width="15%"><font size="3" face="Times New Roman">610</font></td>
</div></center></td>
<td align="center" width="17%"><input type="text" size="10" ID="ac4" value="0" Runat="server"></font></td>
</tr>
<tr>
<td width="30%">VB 6.0与资料库开发圣经</td>
<td align="right" width="10%">480</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font face="Times New Roman" size="3" color="#FF0000">320</font></b></td>
<td align="center" width="15%">六五</font></td>
<td align="center" width="15%">550</font></td>
<td align="center" width="17%"><input type="text" size="10" ID="VB6" value="0" Runat="server"></td>
</tr>
</table>
<input type="button" id="B3" onserverclick="ClickSure" value="确定" runat="server">
</form>
<hr>
<span id="Span1" style="color:red" runat=server></span>
<table id="Table1" CellPadding=5 CellSpacing=0 Border="1" runat="server" />
<span id="Span2" style="color:red" runat=server></
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %><script language="VB" runat="server" Debug="true" >
Sub Session_Start(Sender As Object, E As EventArgs)
Dim DS As New DataSet
Dim D as string
dim x ,f as string
D="server=localhost;uid=sa;database=northwind"
dim NowConn as New SQLConnection(d)
Session("NowSQL")=NowConn
Session("nowUser")=Request.ServerVariables("REMOTE_HOST")
x=Request.PhysicalApplicationPath
f="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x & "mdb\Employ.mdb"
dim ACConn as New sqlconnection(f)
Session("NowACCSam")=ACConn
f="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & x & "mdb\Stock.mdb"
dim ACConn1 as New sqlconnection(f)
Session("NowSTKACC")=ACConn1
D="server=localhost;uid=sa;database=Master"
dim NowConn1 as New SQLConnection(d)
NowConn1.open()
dim re as New SQLCommand
re.Connection=NowConn1
re.CommandText="sp_databases"
re.CommandType = 1
dim k as SQLDataReader
k = re.ExecuteReader()
Do until k.Read=False
If k.GetString(0)="EmploySQL" Then
d="server=localhost;uid=sa;database=EmploySQL"
dim NowConn2 as SQLConnection = New SQLConnection(d)
Session("NowSQLSam")=NowConn2
ElseIf k.GetString(0)="StockSQL" Then
d="server=localhost;uid=sa;database=StockSQL"
dim NowConn3 as SQLConnection = New SQLConnection(d)
Session("NowSTKSQL")=NowConn3
end if
loop
End Sub
Sub Application_BeginRequest(ByVal Sender As Object, ByVal e As EventArgs)
dim x as string
X=Request.ServerVariables("PATH_TRANSLATED")
IF Instr(x,"Usegbl.aspx") > 0 Then
Response.Write(Request.ServerVariables("REMOTE_HOST"))
Response.Write("执行请求中...<br>")
end if
End Sub
Sub Application_EndRequest(ByVal Sender As Object, ByVal e As EventArgs)
dim x as string
X=Request.ServerVariables("PATH_TRANSLATED")
IF Instr(x,"Usegbl.aspx") > 0 Then
Response.Write("执行请求完毕...")
End if
End Sub
</script>buybook.aspx如下:
<html>
<head>
<body background="../../../images/winback.gif">
<!--#INCLUDE FILE="../../../fun.inc"-->
<p>本例档案:BuyBook.aspx 目的:动态产生表格</p>
<p><font size="3">我要订购:(请在订购本数栏位输入数字)</font></p>
<script language="VB" runat="server">
Sub ClickSure(sender As Object, e As EventArgs)
Dim rw As HtmlTableRow
Dim cl As HtmlTableCell
dim x
Span1.InnerHTML="选择内容:"
rw = new HtmlTableRow()'建立新表格列
cl=New HtmlTableCell()'建立新储存格
cl.InnerHtml="书名"'输入资料至储存格
rw.Cells.Add(cl)'加入储存格至表格列
cl=New HtmlTableCell()
cl.InnerHtml="本数"
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml="邮购价"
rw.Cells.Add(cl)
Table1.Rows.Add(rw)'加入表格列至表格
if cint(ac3.Value)>0 then
Ctable("Access 2000 VBA研究大观",cint(ac3.Value),510)
x=x+(cint(ac3.Value)*510)
End if
if cint(ac2.Value)>0 then
Ctable("Access 2000专案开发",cint(ac2.Value),455)
x=x+(cint(ac2.Value)*455)
End if
if cint(ac1.Value)>0 then
Ctable("Access 2000学习直导",cint(ac1.Value),320)
x=x+(cint(ac1.Value)*320)
End if
if cint(ac4.Value)>0 then
Ctable("Access 2000实战问答",cint(ac4.Value),390)
x=x+(cint(ac4.Value)*390)
End if
if cint(vb6.Value)>0 then
Ctable("VB 6.0与资料库开发圣经",cint(vb6.Value),320)
x=x+(cint(VB6.Value)*320)
End if
Span2.InnerHTML="总价:" & x
End sub
Sub CTable(BName,Unit,Price)
Dim rw As HtmlTableRow
Dim cl As HtmlTableCell
rw = new HtmlTableRow()
cl=New HtmlTableCell()
cl.InnerHtml=BName
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml=Unit
rw.Cells.Add(cl)
cl=New HtmlTableCell()
cl.InnerHtml=Price
rw.Cells.Add(cl)
Table1.Rows.Add(rw)
End Sub
</script>
</head>
</blockquote>
<form runat="server">
<table border="1" bordercolor="#FF0000" width="90%">
<tr>
<td align="center" width="30%"><strong>书名</strong></font></td>
<td align="center" width="10%"><strong>售价</strong></font></td>
<td align="center" bordercolor="#0000FF" width="13%"><strong>邮购价</strong></font></td>
<td align="center" width="15%"><strong>折数</strong></font></td>
<td align="center" width="15%"><strong>页数</strong></font></td>
<td width="17%">
<p align="center"><b>订购本数</b></font></p>
</td>
</tr>
<tr>
<td width="30%">Access 2000 VBA研究大观</td>
<td align="right" width="10%">680</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><font color="#FF0000"><b>510</b></font></td>
<td align="center" width="15%">七</font></td>
<td align="center" width="15%">840</font></td>
<td align="center" width="17%"><input type="text" size="10"
id="ac3" value="0" runat="server"></font></td>
</tr>
<tr>
<td width="30%">ACCESS 2000专案开发</td>
<td align="right" width="10%">650</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><font color="#FF0000"><b>455</b></font></td>
<td align="center" width="15%">七</font></td>
<td align="center" width="15%">820</td>
<td align="center" width="17%"><div align="left"><p align="center"><font size="3"><input type="text" size="10"
ID="ac2" value="0" runat="server"></font></p>
</div></td>
</tr>
<tr>
<td width="30%">ACCESS 2000学习直导</font></td>
<td align="right" width="10%">480</font></td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font size="3" color="#FF0000">320</font></b></td>
<td align="center" width="15%">六五</font></td>
<td align="center" width="15%">500</font></td>
<td align="center" width="17%"><input type="text" size="10"
ID="ac1" value="0" runat="server"></font></td>
</tr>
<tr>
<td width="30%">ACCESS 2000实战问答集</a></td>
<td align="right" width="10%">520</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font face="Times New Roman" size="3" color="#FF0000">390</font></b></td>
<td align="center" width="15%">七五</font></td>
<td align="center" width="15%"><font size="3" face="Times New Roman">610</font></td>
</div></center></td>
<td align="center" width="17%"><input type="text" size="10" ID="ac4" value="0" Runat="server"></font></td>
</tr>
<tr>
<td width="30%">VB 6.0与资料库开发圣经</td>
<td align="right" width="10%">480</td>
<td align="center" bordercolor="#0000FF" width="13%" bgcolor="#00FFFF"><b><font face="Times New Roman" size="3" color="#FF0000">320</font></b></td>
<td align="center" width="15%">六五</font></td>
<td align="center" width="15%">550</font></td>
<td align="center" width="17%"><input type="text" size="10" ID="VB6" value="0" Runat="server"></td>
</tr>
</table>
<input type="button" id="B3" onserverclick="ClickSure" value="确定" runat="server">
</form>
<hr>
<span id="Span1" style="color:red" runat=server></span>
<table id="Table1" CellPadding=5 CellSpacing=0 Border="1" runat="server" />
<span id="Span2" style="color:red" runat=server></
解决方案 »
- 求一个新浪微博登陆网站的源代码
- 大家看看我的排名是怎么回事啊???
- 要想实现ajax技术.请会的人进来
- 我用delphi写了一个ActiveX控件,在asp.net中用js语言调用成功,但控件中的Ctrl+C的功能被屏蔽了,Ctrl+V和其它的快捷键没有屏蔽,不知为何
- 一段超简单的HTML代码.可是邪了啊.真是邪了啊.
- 本人就十分了 +asp.net 中难道这两个简单的问题就没有人能解决吗?
- 是不是我的网站被黑了?
- vs 2008 编译后自动调用 混淆器
- 高分请教如何实现中文短信指令智能识别?
- JQUERY事件解绑问题
- 論壇中的回應
- 怎样实现动态的生成水晶报表?也就是数据库中的表名和字段都是不确定的?
StringDatabase="server=localhost;uid=sa;pwd=yourpassword;database=northwind";
D="server=localhost;uid=sa;pwd=;database=northwind";