各位大老幫幫手啦﹗

caifang982095 2003-07-29 03:49:28
我在做更新數据的程序時﹐碰到以下問題﹐還請各位大老幫忙解決﹕在更新時﹐不能在空表PONOTES中插入數据﹐要是在PONOTES表中加入几個DOCNO字段值﹐則可以在PONOTES表中插入VENNOTES的字段值﹔現在怎么樣才可以解決這個問題﹒請各位大老提點提點﹗<%@ import namespace="system.data"%>
<%@ import namespace="system.data.sqlclient"%>
<html>
<script language="vb" runat="server">
Sub page_load(sender as object,e as eventargs)
lblSupplierName.text=session("SuppilerName")

IF not (isPostBack)
CALL bindgrid()
END IF
End Sub
Sub bindgrid
Dim cnnConnection As New SqlConnection()
cnnConnection.ConnectionString=ConfigurationSettings.AppSettings("JDE")
cnnConnection.Open()
Dim cmdSQL As New SqlCommand()
cmdSQL.Connection = cnnConnection
cmdSQL.Commandtext ="select * from vopenpo left join ponotes on ponotes.docno=vopenpo.docno where vopenpo.vencode=" & session("userid") & " order by line_no,shipdate"
dim dr as sqldatareader=cmdSQL.executereader()
grdPO.datasource=dr
grdPO.databind()
cnnConnection.close()
end Sub

'編輯
sub datagrid_editcommand(sender as object,e as datagridcommandeventargs)
grdpo.edititemindex=e.item.itemindex
bindgrid()
end sub

'取消
sub datagrid_cancelcommand(sender as object,e as datagridcommandeventargs)
grdpo.edititemindex=-1
bindgrid()
end sub

'更新
sub datagrid_updatecommand(sender as object,e as datagridcommandeventargs)
dim vennotes as string=ctype(e.item.cells(11).controls(0),textbox).text
dim strsql as string
dim insert as string
strsql="update ponotes set vennotes=" & vennotes & " where " & grdpo.datakeyfield & "=" & grdpo.datakeys(e.item.itemindex) & ""
response.write(strsql)
dim strinsert as string
strinsert="insert ponotes (docno,vennotes) values (" & grdpo.datakeys(e.item.itemindex) & "," & vennotes & ")"
response.write(strinsert)
dim cnnconnection as new sqlconnection()
cnnConnection.ConnectionString=ConfigurationSettings.AppSettings("JDE")
cnnconnection.open()
dim cmdcommand as new sqlcommand(strsql,cnnconnection)
cmdcommand.executenonquery
grdpo.edititemindex=-1
bindgrid()
cnnconnection.close()
end sub
</script>
<body background="#6699cc">
<form runat="server">
<h3><font face="宋体">未完成訂單查詢</font></h3>
<I><Asp:Label Runat="Server" Id="lblSupplierName" ForeColor="Red" font-size="16pt"/>
<br></br>
<asp:datagrid id="grdPO" runat="server"
width="700pt"
backcolor="#ccccff"
borderfooter="false"
cellpadding="3"
cellspacing="0"
font-face="宋体"
font-size="12pt"
datakeyfield="docno"
oneditcommand="datagrid_editcommand"
oncancelcommand="datagrid_cancelcommand"
onupdatecommand="datagrid_updatecommand"
headerstyle-backcolor="#ff9933"
autogeneratecolumns="false"
allowsorting="true"
alternatingitemstyle-backcolor="#eeeeff">
<headerstyle backcolor="#ff9900" forecolor="#ffffff" horizontalalign="center" font-bold="true" font-size="10pt" width="100pt"/>
<pagerstyle backcolor="#ff9933" forecolor="#330099" width="100pt" />
<itemstyle backcolor="#ffffff" forecolor="#330099" font-size="9pt" width="100pt" />
<columns>
<asp:editcommandcolumn edittext="編輯" canceltext="取消" updatetext="更新" headertext="功能"/>
<asp:boundcolumn headertext="交貨日期" datafield="shipdate" dataformatstring="{0:dd/MM/yy}" readonly="true"/>
<asp:boundcolumn headertext="訂單類型" datafield="doctype" readonly="true"/>
<asp:boundcolumn headertext="訂單號" datafield="docno" readonly="true"/>
<asp:boundcolumn headertext="行號" datafield="line_no" readonly="true"/>
<asp:boundcolumn headertext="訂單日期" datafield="podate" dataformatstring="{0:dd/MM/yy}" readonly="true"/>
<asp:boundcolumn headertext="款號" datafield="itemno2" readonly="true"/>
<asp:boundcolumn headertext="訂單說明一" datafield="podesc1" readonly="true"/>
<asp:boundcolumn headertext="數量" datafield="poqty" readonly="true"/>
<asp:boundcolumn headertext="單位" datafield="pduom" readonly="true"/>
<asp:boundcolumn headertext="訂單說明二" datafield="podesc2" readonly="true"/>
<asp:boundcolumn headertext="備注" datafield="vennotes"/>
<asp:templatecolumn>
<itemtemplate>
<a href="http://192.168.1.240/testing/displaypic.aspx?id=<%#container.dataitem("itemno1")%>&code=<%#container.dataitem("imtype1")%>" textfield="款號"><%# container.dataitem("itemno2")%></a>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
</form>
</body>
</html>





...全文
57 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
caifang982095 2003-07-31
  • 打赏
  • 举报
回复
沒有表間約束啊﹗﹗現在能夠更新插入﹐但是再次更新一條紀錄的時候﹐它會又插入一條紀錄﹗很幾啊﹗老板天天在催﹗﹗
sin360 2003-07-29
  • 打赏
  • 举报
回复
检查数据库结构,是否有表间约束
内容概要:本文围绕掺铒光纤放大器(EDFA)的分析模型展开深入的模拟研究,重点在于利用Matlab代码实现EDFA工作过程的数值仿真,涵盖其增益特性、噪声系数以及在不同泵浦功率和波长条件下的性能表现。研究通过建立基于速率方程和传输方程的物理模型,精确描述铒离子的能级跃迁、自发辐射、受激辐射及吸收等核心物理机制,进而构建可用于光通信系统级仿真的EDFA模块。该模型不仅能够准确预测单级EDFA的输出光谱和增益平坦度,还支持对多级放大链路的级联效应进行分析与优化,具备良好的实用性、灵活性和可扩展性,为光通信系统的设计与性能评估提供了可靠的理论依据和工具支持。; 适合人群:具备一定光学通信基础知识和Matlab编程能力的研究生或科研人员,尤其适用于从事光纤通信系统仿真、光器件建模与性能优化等相关领域的工程技术人员。; 使用场景及目标:①用于高校及科研机构中关于光放大器原理的教学演示与科研分析;②支撑长距离、大容量光纤传输系统中多级EDFA链路的性能预测、噪声累积分析与优化设计;③作为典型有源光器件建模的学习案例,帮助理解复杂光电器件的数值仿真方法与物理机制。; 阅读建议:建议读者结合光通信相关理论知识,仔细研读模型的数学推导过程,并动手运行与调试所提供的Matlab代码,深入探究泵浦方式、光纤长度、掺杂浓度等关键参数对EDFA性能的影响规律,进一步可尝试将该模型集成至更大规模的光网络仿真平台中进行联合系统分析。

62,271

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧