dyxx.aspx
来自「ASP.NET开发实战详解」· ASPX 代码 · 共 481 行 · 第 1/2 页
ASPX
481 行
dim shiymjstr as string
dim kzmjstr as string
dim snmjstr as string
myDataRowCollection=dtable.rows
if lc1="" or lc2="" or qzstr="" then
page.registerstartupscript("",getalertinfo("楼层范围及前缀均不可为空!"))
exit sub
end if
if not isnumeric(trim(lc1)) or not isnumeric(trim(lc2)) then
page.registerstartupscript("",getalertinfo("错误的楼层范围!"))
exit sub
end if
if cint(lc1)>cint(lc2) then
page.registerstartupscript("",getalertinfo("楼层范围请按由小到大的顺序排列!"))
exit sub
end if
if myDataRowCollection.count=0 then
page.registerstartupscript("",getalertinfo("请先创建单元!"))
exit sub
end if
dycode=trim(lgcode) & trim(ltcode)
sql="select * from fc_cell where left(code,6)='" & Dycode & "'"
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
cnn.open()
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
page.registerstartupscript("",getalertinfo("存在重复的单元信息,数据无法保存!"))
else
datar.close()
for i=cint(lc1) to cint(lc2)
for each theRow In mydatarowcollection
codestr= Dycode & Format(i, "00") & Format(therow(0), "00")
namestr=trim(qzstr) & Format(i, "00") & Format(therow(0), "00")
ggstr=therow(1).tostring
cxstr=therow(3).tostring
gnstr=therow(5).tostring
zxstr=therow(7).tostring
symjstr=Iif(IsDbNull(therow(9)),"0",therow(9))
sfmjstr=Iif(IsDbNull(therow(11)),"0",therow(11))
jzmjstr=Iif(IsDbNull(therow(10)),"0",therow(10))
fjmjstr=Iif(IsDbNull(therow(12)),"0",therow(12))
czmjstr=Iif(IsDbNull(therow(13)),"0",therow(13))
ptmjstr=Iif(IsDbNull(therow(15)),"0",therow(15))
shiymjstr=Iif(IsDbNull(therow(14)),"0",therow(14))
kzmjstr=Iif(IsDbNull(therow(17)),"0",therow(17))
snmjstr=Iif(IsDbNull(therow(16)),"0",therow(16))
sql="insert into fc_cell(code,name,lgcode,ltcode,gg,cx,gn,zx,symj,sfmj,jzmj,fjmj,czmj,ptmj,shiymj,kzmj,snmj,state) values('" & codestr & "','" & namestr & "','" & lgcode & "','" & ltcode & "','" & ggstr & "','" & cxstr & "','" & gnstr & "','" & zxstr & "'," & symjstr & "," & sfmjstr & "," & jzmjstr & "," & fjmjstr & "," & czmjstr & "," & ptmjstr & "," & shiymjstr & "," & kzmjstr & "," & snmjstr & ",'2')"
cmd=new sqlcommand(sql,cnn)
cmd.executenonquery()
next
next
dtable.rows.clear()
bindgrid()
page.registerstartupscript("",getalertinfo("数据保存成功!"))
end if
End Sub
Sub ChangeLP(sender As Object, e As EventArgs)
Sellg.DataSource = CreateDataSource("lg")
Sellg.DataTextField = "name"
Sellg.DataValueField = "code"
Sellg.DataBind()
End Sub
Function CreateDataSource(byval para as string) As ICollection
dim dtcmd as sqldataadapter
dim dset as dataset
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
select case trim(para)
case "lp"
dtcmd=new sqldataadapter("select code,name from fc_lp order by code",cnn)
case "lg"
dtcmd=new sqldataadapter("select code,name from fc_lg where lpcode='" & trim(sellp.selecteditem.value) & "' order by code",cnn)
case "lt"
dtcmd=new sqldataadapter("select code,name,type from fw_para where type='LT' order by code",cnn)
case "gn"
dtcmd=new sqldataadapter("select code,name,type from fw_para where type='GN' order by code",cnn)
case "cx"
dtcmd=new sqldataadapter("select code,name,type from fw_para where type='CX' order by code",cnn)
case "gg"
dtcmd=new sqldataadapter("select code,name,type from fw_para where type='GG' order by code",cnn)
case "zx"
dtcmd=new sqldataadapter("select code,name,type from fw_para where type='ZX' order by code",cnn)
end select
dset=new dataset
dtcmd.fill(dset)
Dim dv As New DataView(dset.tables(0))
Return dv
cnn.close()
End Function
Function GetAlertInfo(byval str1 as string) as String
dim Str2 as String
str2="<script language='javascript'>alert('" & str1 & "')<"
str2+="/"
str2+="script>"
return trim(str2)
End Function
</script>
<html>
<head>
<link href="../Main.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form runat="server">
<table id="search" cellspacing="1" cellpadding="0" width="95%" align="center" border="0">
<tbody>
<tr class="tr4">
<td height="40" width="25%">
楼 盘
<asp:DropDownList class="input_text" id="Sellp" runat="server" width="90" OnSelectedIndexChanged="ChangeLP" autopostback="true"></asp:DropDownList>
</td>
<td width="25%">
楼 阁
<asp:DropDownList class="input_text" id="Sellg" runat="server" width="90"></asp:DropDownList>
</td>
<td width="25%">
楼 梯
<asp:DropDownList class="input_text" id="Sellt" runat="server" width="90"></asp:DropDownList>
</td>
<td>
每层单元
<asp:TextBox class="input_text" id="mcdy" runat="server" width="90"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td height="40">
楼层范围
<asp:TextBox class="input_text" id="lcfw1" runat="server" width="40"></asp:TextBox>
—
<asp:TextBox class="input_text" id="lcfw2" runat="server" width="40"></asp:TextBox>
</td>
<td>
前 缀
<asp:TextBox class="input_text" id="qz" runat="server" width="90"></asp:TextBox>
</td>
<td colspan=2 align=center>
<asp:button id="CreateBtn" onclick="Create_Click" runat="server" text="创 建"></asp:button>
</td>
</tr>
</tbody>
</table>
<hr>
<table id="search" cellspacing="1" cellpadding="0" width="95%" align="center" border="0">
<tr class="tr4">
<td height="30" width="25%">
规 格
<asp:DropDownList id="Selgg" runat="server" width="90"></asp:DropDownList>
</td>
<td width="25%">
朝 向
<asp:DropDownList id="Selcx" runat="server" width="90"></asp:DropDownList>
</td>
<td width="25%">
功 能
<asp:DropDownList id="Selgn" runat="server" width="90"></asp:DropDownList>
<td width="25%">
装 修
<asp:DropDownList id="Selzx" runat="server" width="90"></asp:DropDownList>
</td>
</tr>
<tr class="tr4">
<td height="30" width="25%">
使用面积
<asp:TextBox class="input_text" id="symj" runat="server" width="90"></asp:TextBox>
</td>
<td width="25%">
建筑面积
<asp:TextBox class="input_text" id="jzmj" runat="server" width="90"></asp:TextBox>
</td>
<td width="25%">
收费面积
<asp:TextBox class="input_text" id="sfmj" runat="server" width="90"></asp:TextBox>
<td width="25%">
附加面积
<asp:TextBox class="input_text" id="fjmj" runat="server" width="90"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td height="30" width="25%">
出租面积
<asp:TextBox class="input_text" id="czmj" runat="server" width="90"></asp:TextBox>
</td>
<td width="25%">
实用面积
<asp:TextBox class="input_text" id="shiymj" runat="server" width="90"></asp:TextBox>
</td>
<td width="25%">
平台面积
<asp:TextBox class="input_text" id="ptmj" runat="server" width="90"></asp:TextBox>
<td width="25%">
室内面积
<asp:TextBox class="input_text" id="snmj" runat="server" width="90"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td height="30" width="25%">
空置面积
<asp:TextBox class="input_text" id="kzmj" runat="server" width="90"></asp:TextBox>
</td>
<td width="25%">
更 新 行
<asp:TextBox class="input_text" id="updateH" runat="server" width="90"></asp:TextBox>
</td>
<td colspan=2 align=center>
<asp:button id="UpdateBtn" onclick="Update_Click" runat="server" text="更 新"></asp:button>
</td>
</tr>
</table>
<asp:DataGrid id="DataGrid1" runat="server" width="95%" Font-Names="verdana" bordercolor="Black" cellpadding="2" font-name="verdana" font-size="8pt" headerstyle-backcolor="#F8FAFC" AutoGenerateColumns="False" PageSize="10" align=center>
<HeaderStyle font-bold="True" horizontalalign="Center" verticalalign="Middle" backcolor="#F8FAFC"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="id" HeaderText="序号"></asp:BoundColumn>
<asp:BoundColumn DataField="ggname" HeaderText="规格"></asp:BoundColumn>
<asp:BoundColumn DataField="cxname" HeaderText="朝向"></asp:BoundColumn>
<asp:BoundColumn DataField="gnname" HeaderText="功能"></asp:BoundColumn>
<asp:BoundColumn DataField="zxname" HeaderText="装修"></asp:BoundColumn>
<asp:BoundColumn DataField="symj" HeaderText="使用面积"></asp:BoundColumn>
<asp:BoundColumn DataField="jzmj" HeaderText="建筑面积"></asp:BoundColumn>
<asp:BoundColumn DataField="sfmj" HeaderText="收费面积"></asp:BoundColumn>
<asp:BoundColumn DataField="fjmj" HeaderText="附加面积"></asp:BoundColumn>
<asp:BoundColumn DataField="czmj" HeaderText="出租面积"></asp:BoundColumn>
<asp:BoundColumn DataField="shiymj" HeaderText="实用面积"></asp:BoundColumn>
<asp:BoundColumn DataField="ptmj" HeaderText="平台面积"></asp:BoundColumn>
<asp:BoundColumn DataField="snmj" HeaderText="室内面积"></asp:BoundColumn>
<asp:BoundColumn DataField="kzmj" HeaderText="空置面积"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
<p align="center">
<asp:button id="ClearBtn" onclick="clear_Click" runat="server" text="清 除"></asp:button>
<asp:button id="SaveBtn" onclick="Save_Click" runat="server" text="保 存"></asp:button>
</p>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?