|
|
|
我有一个system, 就当在那个form 添了certain given 的data, 要save 时,save不到进database, 因为本身有create一个Error Message page, 当save就跳去那个page.. duplicate record exist in database. 但是那个data 没在database 里。 只有CERTAIN DATA 出现这问题。该怎麽办?? |
|
|
|
|
|
|
|
|
|
|
发表于 14-8-2010 02:58 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 14-8-2010 09:26 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 17-8-2010 09:27 AM
|
显示全部楼层
<%@ Language=VBScript %>
<!--#include file="../Include/Library/ApplicationConst.asp" -->
<!--#include file="../Include/Library/VBFunction.asp" -->
<!--#include file="../Include/Data/dbSettings.asp" -->
<!--#include file="../Include/Data/DBLibrary.asp" -->
<!--#include File="../UserIndex1.asp"-->
<%
Dim strDCLocation : strDCLocation = ""
Dim strId : strId = Trim(Request.QueryString("Id"))
Dim strMode : strMode = Trim(Request.QueryString("Mode"))
select case strMode
case "Add"
strTitle = "Equipment - Add"
strHSystemID = trim(Request.Form("HSystemID"))
strDCEqDesc = trim(Request.Form("txtDCEqDesc"))
strDCTagNo = trim(Request.Form("txtDCTagNo"))
strDCSerialNo = trim(Request.Form("txtDCSerialNo"))
strDCManufacturer = trim(Request.Form("txtDCManufacturer"))
strDCDocCode = trim(Request.Form("txtDCDocCode"))
strDCDocDesc = trim(Request.Form("txtDCDocDesc"))
' strDCDocTitle = trim(Request.Form("txtDCDocTitle"))
strDCDrwNo = trim(Request.Form("txtDCDrwNo"))
strDCEngDoc = trim(Request.Form("txtDCEngDoc"))
strEngCode = trim(Request.Form("txtDCEngCode"))
strDCLocation = trim(Request.Form("txtDCLocation"))
strDCPlant = trim(Request.Form("txtDCPlant"))
strDCFreq = trim(Request.Form("txtDCFreq"))
strDCRange = trim(Request.Form("txtDCRange"))
if len(trim(Request.Form("txtDCStatus"))) <> 0 then
strDCStatus = trim(Request.Form("txtDCStatus"))
else
strDCStatus = "1"
end if
strDCTolError = trim(Request.Form("txtDCTolError"))
strDCRemarks = trim(Request.Form("txtDCRemarks"))
case "Edit"
strTitle = "Equipment - Edit"
'Open Connection
Call OpenConnection
'Retrieve data from M_EquipmentMaster
strSQL = "SELECT a.*,b.ISODoc_Code,b.ISODoc_Title,a.E_EngDoc as EngCode,a.E_EngDoc as EngTitle FROM M_EquipmentMaster a left join D_ISODoc b on E_DocCode = b.ISODoc_ID "
strSQL = strSQL & "Where E_ID = " & strId
'response.Write("SQL::" & strSQL & "<br>")
Call OpenRecordset(strSQL, 2, 3)
If not rstProject.EOF then
strDCEqDesc = trim(rstProject("E_EquipmentName"))
strDCTagNo = trim(rstProject("E_TagNo"))
strDCSerialNo = trim(rstProject("E_SerialNo"))
strDCManufacturer = trim(rstProject("E_Manufacturer"))
strDCDocCode = trim(rstProject("E_DocCode"))
strDCDocDesc = trim(rstProject("ISODoc_Code"))
strDCDocTitle = trim(rstProject("ISODoc_Title"))
strDCDrwNo = trim(rstProject("E_DrawingNo"))
strDCEngDoc = trim(rstProject("E_EngDoc"))
strEngCode = trim(rstProject("EngCode"))
strDCLocation = trim(rstProject("E_Location"))
strDCPlant = trim(rstProject("E_Plant"))
strDCFreq = trim(rstProject("E_Frequency"))
strDCRange = trim(rstProject("E_Range"))
strDCStatus = trim(rstProject("E_Status"))
strDCTolError = trim(rstProject("E_TolError"))
strDCRemarks = trim(rstProject("E_Remarks"))
end if
rstProject.close
' cnnProject.close
' Set rstProject = Nothing
' Set cnnProject = Nothing
end select
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<LINK Rel="stylesheet" Type="text/css" HREF="../Include/Style/MyStyle.css">
<title><%=strTitle%></title>
<SCRIPT LANGUAGE="JavaScript">
function SaveVal(){
if (document.frmMain.txtDCEqDesc.value==''){
window.alert("Please enter Equipment Name");
document.frmMain.txtDCEqDesc.focus();}
else if (document.frmMain.txtDCDocDesc.value==''){
window.alert("Please enter Doc Code");
document.frmMain.txtDCDocDesc.focus();}
else if (document.frmMain.txtDCTagNo.value==''){
window.alert("Please enter Tag No.");
document.frmMain.txtDCTagNo.focus();}
else if (document.frmMain.txtDCSerialNo.value==''){
window.alert("Please enter Serial No.");
document.frmMain.txtDCSerialNo.focus();}
else if (document.frmMain.txtDCManufacturer.value==''){
window.alert("Please enter Manufacturer");
document.frmMain.txtDCManufacturer.focus();}
else if (document.frmMain.txtDCLocation.value==''){
window.alert("Please enter Location");
document.frmMain.txtDCLocation.focus();}
else if (document.frmMain.txtDCPlant.value==''){
window.alert("Please enter Plant");
document.frmMain.txtDCPlant.focus();}
else if (document.frmMain.txtDCRange.value==''){
window.alert("Please enter Range");
document.frmMain.txtDCRange.focus();}
else if (document.frmMain.txtDCFreq.value==''){
window.alert("Please enter Frequency");
document.frmMain.txtDCFreq.focus();}
else if (document.frmMain.txtDCDrwNo.value==''){
window.alert("Please enter Drawing No");
document.frmMain.txtDCDrwNo.focus();}
else if (document.frmMain.txtEngCode.value==''){
window.alert("Please enter Engineering Document No");
document.frmMain.txtEngCode.focus();}
else{
document.frmMain.action = "DCEquipmentPrc.asp?Mode=<%=strMode%>"
document.frmMain.submit();}
}
function ModeChange(){
document.frmMain.action = 'DCEquipmentDsp.asp?Mode=Add';
document.frmMain.submit();
}
</SCRIPT>
</HEAD>
<BODY>
<BR>
<!--#include file="../Include/Javascript/OpenWindowSetting.inc" -->
<div align="center"><center>
<form method="POST" name="frmMain" id="frmMain">
<table border="0" cellspacing="0" width="600">
<ColGroup>
<td width="400"></td>
<td width="200"></td>
</ColGroup>
<tr>
<td class="clsTableBotomBorder"><%=strTitle%></td>
<td class="clsTableBotomBorder" align="Right"><%=cCompulsoryText%></td>
</tr>
</table>
<table border="0" cellspacing="1" width="600">
<ColGroup>
<td width="200"></td>
<td width="400"></td>
</ColGroup>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Doc Code : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCDocDesc" value="<%=strDCDocDesc%>" size="30" Maxlength="50" OnChange="JavaScript:ModeChange()">
<INPUT TYPE="HIDDEN" NAME="txtDCDocCode" Value="<%=strDCDocCode%>"> <A href="JavaScript:OpenWindow('DCSearchDocDspA.asp?SysId=1&Prm=1')"><IMG Src="../Images/Search.gif" border=0 Title="Search existing document" Style="Cursor:Hand"></a><br> <%=strDCDocTitle%></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Equipment Name : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCEqDesc" value="<%=strDCEqDesc%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Tag No : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCTagNo" value="<%=strDCTagNo%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Manufacturer : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCManufacturer" value="<%=strDCManufacturer%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Serial No : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCSerialNo" value="<%=strDCSerialNo%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Location : </td> |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 17-8-2010 09:27 AM
|
显示全部楼层
<td Class="clsValueColor"> <select size="1" Class="clsCtrl" name="txtDCLocation">
<Option Value="" selected>-</Option>
<% strSQL = "Select DCLoc_ID, DCLocDesc From M_DCLocation Order by DCLocDesc "
' Call OpenRecordset(strSQL, 3, 1)
strHTML = GenSelectOpt(strSQL,"DCLoc_ID","DCLocDesc",strDCLocation)
'response.Write (strSQL & " " & strDCLocation & "<br>")
Response.Write (strHTML)
%> </select>
</td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Plant : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCPlant" value="<%=strDCPlant%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Drawing No : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCDrwNo" value="<%=strDCDrwNo%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Frequency : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCFreq" value="<%=strDCFreq%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>ENG.WI.01. : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtEngCode" value="<%=strEngCode%>" size="30" Maxlength="50" >
<INPUT TYPE="HIDDEN" NAME="txtDCEngDoc" Value="<%=strDCEngDoc%>"> </td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor">Max Permissible Error : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCTolError" value="<%=strDCTolError%>" size="50" Maxlength="150"></td>
</tr>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor"><%=cCompulsoryField%>Range : </td>
<td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCRange" value="<%=strDCRange%>" size="50" Maxlength="150"></td>
</tr>
<%
' <tr height="<%=cRowHeight">
' <td Class="clsTitleColor">Remarks : </td>
' <td Class="clsValueColor"> <Input type="Text" Class="clsCtrl" name="txtDCRemarks" value="=strDCRemarks" size="50" Maxlength="150"></td>
' </tr>
redim StsOptions(3)
StsOptions(1) = "Pending"
StsOptions(2) = "Active"
StsOptions(3) = "Obsolete"
if strMode <> "Add" then %>
<tr height="<%=cRowHeight%>">
<td Class="clsTitleColor">Status : </td>
<td Class="clsValueColor">
<%
for i = 1 to 3
if cint(strDCStatus) = i then
response.Write( StsOptions(i) & chr(10) )
end if
next
%>
</td>
</tr>
<% else %>
<INPUT TYPE="HIDDEN" NAME="txtDCStatus" Value="1">
<% end if %>
</table>
<BR>
<table border="0" cellspacing="1" width="600">
<ColGroup>
<td width="600"></td>
</ColGroup>
<tr>
<td align="Center">
<input type="button" Class="clsButton" onclick="SaveVal()" value="Save" name="Save"
OnMouseOver="this.className='clsButtonOver'" OnMouseOut="this.className='clsButton'">
<input type="button" Class="clsButton" onclick="JavaScript:window.location.replace('DCEquipmentView.asp')" value="Return" name="Cancel"
OnMouseOver="this.className='clsButtonOver'" OnMouseOut="this.className='clsButton'">
</td>
</tr>
</table>
<INPUT TYPE="HIDDEN" NAME="Id" Value="<%=strId%>">
<INPUT TYPE="HIDDEN" NAME="HDCEquipment" Value="<%=strDCEqDesc%>">
</form>
</div>
</BODY>
</HTML> |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 17-8-2010 09:37 AM
|
显示全部楼层
回复 2# mylover
我的primary key 是EL_ID |
|
|
|
|
|
|
|
|
|
|
发表于 18-8-2010 12:01 PM
|
显示全部楼层
|
你的EL_ID有没有auto increment? |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|